2个问题:PHP代码在Apache Web服务器上成功运行,但在本地EasyPHP上运行不成功?

时间:2012-12-04 20:41:31

标签: php easyphp

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; 

1 个答案:

答案 0 :(得分:0)

尝试:

function print_form() { 
?>
<h1>Welcome to the player registration page. Please input the following:</h1>
...
<? } ?>

我认为这种方式更容易......