print <<<EOT 出现提示Parse error: syntax error, unexpected $end in 如何解决?

错误提示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>记录 &nbsp;<a href="topic.php">查看全部&raquo;</a></p>

    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</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>&nbsp;</p>
  <p>&nbsp;</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>&nbsp;</p>
</div>
<!--<?php
EOT;
?>-->

 

如何解决?

short_tag_open 是on的。文件的编码都是UTF-8的。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值