1:当我在网络服务器上运行此代码(省略了一些不必要的代码)时,它运行良好。我有一个 EasyPHP 设置,当我在上面运行完全相同的代码时,我得到了错误:
Parse error: syntax error, unexpected '<<' (T_SL) in C:\Program Files (x86)\EasyPHP-12.1\www\my portable files\part1.php on line 985
(第 985 行注释如下)
2:每当我在网络服务器上运行此代码时,它说我无权访问$_SERVER[PHP_SELF]
,所以我必须使用“”。虽然 "" 有效,但无法正确验证。
注意:我无法正确格式化代码块。下面的块应该读作一个连续的块。
function print_form() {
echo <<<END /*Line 985*/
<h1>Welcome to the player registration page. Please input the following:</h1>
<form action="$_SERVER[PHP_SELF]" method="post">
<div class="name">
Username: <input type="text" name="name" size="12" /> <br />
</div>
<div class="country">
Country: <select name="country">
<option value="">Select Country</option>
<option value="AF">Afghanistan</option>
...
<option value="ZW">Zimbabwe</option>
</select>
</div>
<div class="xfire">
Xfire: <input type="text" name="xfire" /> <br />
</div>
<div class="team">
Team: <input type="text" name="team" /> <br />
</div>
<div class="tag">
Tag: <input type="text" name="tag" /> <br />
</div>
<input type="hidden" name="stage" value="process">
Submit Info:
<input type="submit" value="Submit"/>
</form>
END;