刚学习php,看了一本书上的例子,代码如下:
<html>
<head>
<title>Hi User</title>
</head>
<body>
<h1>Hi User</h1><?if (empty($userName)){
print <<<HERE
<form>
Please enter your name:
<input type = "text"
name = "userName"><br>
<input type = "submit">
</form>
HERE;} else {
print "<h3>Hi there, $userName!</h3>";
} //end
?></body>
</html>
但是我在输入上述代码后,保存为.php文件,用浏览器看结果的时候,发现else里的语句没有运行,请问这是什么问题?谢谢了
<html>
<head>
<title>Hi User</title>
</head>
<body>
<h1>Hi User</h1><?if (empty($userName)){
print <<<HERE
<form>
Please enter your name:
<input type = "text"
name = "userName"><br>
<input type = "submit">
</form>
HERE;} else {
print "<h3>Hi there, $userName!</h3>";
} //end
?></body>
</html>
但是我在输入上述代码后,保存为.php文件,用浏览器看结果的时候,发现else里的语句没有运行,请问这是什么问题?谢谢了
{
print <<<HERE
<form>
Please enter your name:
<input type = "text"
name = "userName"><br>
<input type = "submit">
</form>
HERE;
}
else
{
print "<h3>Hi there, $userName!</h3>";}这样试试看可以不可以????
用isset也不行