首页 > Web开发 > 详细

PHP关于syntax error语法错误的问题(Parse error: syntax error, unexpected end of file in xxxxxxxx)

时间:2020-05-03 16:14:06      阅读:61      评论:0      收藏:0      [点我收藏+]

在php程序出现类似

Parse error: syntax error, unexpected end of file in xxxxxxxx  on line xx

的错误。

如图

技术分享图片

 

 

 

如果发现php的语法本身没有什么错误。就有可能是使用了短标签,例如:

<? }?>

这种问题的解决方案是:

可以在php.ini中设置short_open_tag = On 

 

---------------------------------------------------------

short_open_tag 是什么呢?

决定是否允许使用代码开始标志的缩写形式(<? ?> )。如果要和 XML 结合使用 PHP,可以禁用此选项以便于嵌入使用<?xml ?> 。否则还可以通过php来输出,例如:<?php echo ‘<?xml version="1.0"‘; ?> 。如果禁用了,必须使用 PHP 代码开始标志的完整形式(<?php ?> )。


注意:本指令也会影响到缩写形式 <?= ,它和 <? echo 等价。使用此缩写需要short_open_tag 的值为 On。
————————————————


原文链接:https://blog.csdn.net/u014175572/java/article/details/52798684

PHP关于syntax error语法错误的问题(Parse error: syntax error, unexpected end of file in xxxxxxxx)

原文:https://www.cnblogs.com/lcxin/p/12822036.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!