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

在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

猜你喜欢

转载自www.cnblogs.com/lcxin/p/12822036.html