print <<<EOT 出现提示Parse error: syntax error, unexpected $end in 如何解决?
2009-08-02 19:39
363 查看
错误提示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的。
出现原因:使用了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的。
相关文章推荐
- 编译Sonatype Nexus源代码出现“无法确定 <R>R 的类型参数”错误的解决
- 如何解决用"adobe pdf"打印Djvu文件出现横线或横条的问题
- MyEclipse中出现Multiple annotations found at this line: - Syntax error, insert "}" to complete 错误解决方法
- maven项目出现web.xml is missing and <failOnMissingWebXml> is set to true错误的解决办法
- android NDK开发编译C++文件出现Type 'jint' could not be resolved和Unresolved inclusion: <jni.h>的解决办法
- 导入别的工程的时候出现Unable to resolve target 'android-8'如何解决
- 【android】NDK开发编译C++文件出现Type 'jint' could not be resolved和Unresolved inclusion: <jni.h>的解决办法
- 如何解决服务器CPU使用率过高的问题<二>
- VC6.0编程用到#include <unistd.h>编译时出现的错误及解决方法
- maven中出现web.xml is missing and <failOnMissingWebXml> is set to true的错误如何解决
- 重装系统时出现<windows root>\system32\ntoskrnl.exe 损坏或者丢失?解决方法。。。。。。
- 出现<authentication mode="Windows"/>错误解决办法
- VC中使用wxWidgets 出现的编译错误 error C2059: syntax error : 'constant' 解决
- 关于android底层库编译出现“undefined reference to `__android_log_print'”的解决方法
- Android中launcherMode="singleTask"详解<解决home键返回不能出现原界面问题>
- VS中使用CXTPDockingPane出现的编译错误 error C2059: syntax error : 'constant' 解决
- jsp 引入文件(<jsp:include page)出现乱码的解决办法
- 警告信息<uses-permission> tag appears after <application> tag出现的原因及解决办法
- android NDK开发编译C++文件出现Type 'jint' could not be resolved和Unresolved inclusion: <jni.h>的解决办法
- 如何解决VS2008调试时出现LINK : fatal error LNK1104: cannot open file 'LIBC.lib'