解析错误:语法错误,意外'<<<第16行的C:\ xampp \ htdocs \ kensift \ index.php中的(T_SL)

时间:2016-08-22 09:15:23

标签: php html html5 error-handling operators

我正努力将html注册表单及其php响应脚本合并到一个文件中的单个程序中。请检查以下代码:     问题是,每次我尝试运行此程序时,Parse错误syntax error, unexpected '<<' (T_SL)都会显示出来!可能出现什么问题?     将非常感谢帮助..

<!DOCTYPE html> 
<head><title>home</title></head> 
<body> 
<?php if (filter_has_var(INPUT_POST, "username")){ 
// the form exists, so work with it 
$username=filter_input(INPUT_POST, "username"); 
print "<center><h1>Great going $username!<br>What type of room would you like to create?</h1></center>"; 
} else {
 //there's no input, hence create the form 
print <<<HERE 
<form action="php/index.php" method="post"> <center>     
<input type="text" name="fullname" placeholder="Full Name" size="25" required> 
<input type="email" name="email" placeholder="Email or Mobile" size="25" required> 
<input type="password" name="psw" placeholder="Password" size="25" required> </center><br> 
<input type="submit" value="Here You Go!"/><br><br> 
<center><h4>By clicking "Here You Go!" you agree with our terms & conditions and private policy.</h4></center> </form> HERE; 
} //end 'value exists' if ?> 
</body> 
</html>

jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj

1 个答案:

答案 0 :(得分:1)

您的代码存在的问题是,print <<<HERE之后您在此处有空格字符 请删除它。

此外,您必须将HERE;关闭到新行,然后删除空格;

https://3v4l.org/djrjq

中所示