错误提示Parse error: syntax error, unexpected $end in
出现原因:使用了print<<<EOT
文件
index.php
templates/default/index.html
index.php文件中的内容如下
<?php
include('class/inc.php');
$pagetitle = '天涯!';
include tpl.'incheaderindex.html';
include tpl.'incleft.html';$html='dd';
$totalNum='023';
include tpl.'index.html';
include tpl.'incfooter.html';
mysql_close($DB->conn);
?>
index.html文件中的内容全部如下:
<!--<?php
print <<<EOT
?>-->
<div id="right">
$html<p class="meta">共<span class="number"><a href="topic.php" title="查看全~">$totalNum</a></span>记录 <a href="topic.php">查看全部»</a></p><p> </p>
<p> </p>
<p> </p>
</div>
<p style="clear:both"></p>
<!--<?php
EOT;
?>-->
当去除print <<<EOT 和EOT;的部分,那么就不会出现这个错误提示。
但是在当引入另外一个文件ip.html而不是这个index.html文件的时候,不会出现错误提示。
index.php文件中引入templates/default/ip.html
index.php文件中的内容是$ip="120.0.0.0",
会直接执行,IP.html文件中的全部内容如下:
<!--<?php
print <<<EOT
?>-->
<div id="header">
<p> </p>
<p> </p>
<p class="logo">您当前的IP为:<strong>$ip</strong></p>
<p>不在被限制的范围中~</p>
<p><hr /></p>
<p>已被禁止的IP地址列表如下:</p>
<table width="100%" border="0" cellspacing="0">
<tr class="dash">
<th>IP地址</th>
<th>开始日期</th>
<th>结束日期</th>
<th>备注/原因</th>
</tr>
<tr>
<td>127.56.*.*</td>
<td>2009-07-12</td>
<td>2009-12-18</td>
<td></td>
</tr>
<tr class="dash">
<td>58.123.*.*</td>
<td>2009-08-03</td>
<td>2009-12-12</td>
<td></td>
</tr>
</table>
<p> </p>
</div>
<!--<?php
EOT;
?>-->
如何解决?
short_tag_open 是on的。文件的编码都是UTF-8的。