syntax error, unexpected $end
来源:互联网 发布:速度达软件 编辑:程序博客网 时间:2024/05/19 13:16
Parse error: syntax error, unexpected $end in script.php on line xx
一、多了个 ?>
一、多了个 ?>
调试了一会后发现产生错误的行是文件中间某行
//$str .= "?>\n";
想起来了 PHP 解释器允许的结尾标记那行还可以用单行注释,即 //$str .= "?>\n"; 被解释成结尾标记前有注释,注释的内容是 //$str .= ",而 ?> 后面的 \n"; 会被解释作 PHP 块外的内容按 HTML 输出出去!结果是给 $str .= "?>\n"; 这行添加 // 成注释后,反而多了个 ?> 的结束标记,造成原来真正的结束标记成了意料之外的(unexpected)了。
解决办法就是直接删掉这一行即可。
//$str .= "?>\n";
想起来了 PHP 解释器允许的结尾标记那行还可以用单行注释,即 //$str .= "?>\n"; 被解释成结尾标记前有注释,注释的内容是 //$str .= ",而 ?> 后面的 \n"; 会被解释作 PHP 块外的内容按 HTML 输出出去!结果是给 $str .= "?>\n"; 这行添加 // 成注释后,反而多了个 ?> 的结束标记,造成原来真正的结束标记成了意料之外的(unexpected)了。
解决办法就是直接删掉这一行即可。
二。换环境了。php.ini中有一个short_open_tag=on ,变成了off,<?}?>不会被识别了。
在php的配置文件(php.ini)中有一个short_open_tag的值,开启以后可以使用PHP的段标签:(<? ?>
)。
同时,只有开启这个才可以使用 <?= 以代替
<? echo 。在CodeIgniter的视频教程中就是用的这种方式。
但是这个短标签是不推荐的,使用<?php ?>才是规范的方法。只是因为这种短标签使用的时间比较长,这种特性才被保存了下来。
0 0
- syntax error, unexpected $end
- syntax error: unexpected end of file
- syntax error: unexpected end of file
- shell:syntax error:unexpected end of file
- syntax error: unexpected end of file解决方法
- syntax error:unexpected end of file
- syntax error: unexpected end of file
- syntax error, unexpected end of file
- PHP 解决Parse error: syntax error, unexpected $end问题
- PHP Parse Error: syntax error, unexpected $end 解决方法
- 莫名其妙的Parse error: syntax error, unexpected $end
- 莫名其妙的Parse error: syntax error, unexpected $end
- Parse error: syntax error, unexpected end of file in
- Parse error: syntax error, unexpected $end in ...php
- Parse error: syntax error, unexpected end of file
- syntax error near unexpected token 和 Linux Shell syntax error: unexpected end of file
- SHELL syntax error:unexpected end of file 提示错误
- Shelll 错误 syntax error: unexpected end of file
- 架构师基本功:消息队列
- DeDe 父栏目调用可多级支持currentstyle
- 阳历到农历转换的一个PHP类
- 解决WordPress后台一直提示更新翻译
- 2014年07月14日
- syntax error, unexpected $end
- 不带www的域名怎么设置解析
- onload 和 onunload 事件可用于处理 cookie。
- 199. Binary Tree Right Side View
- 关于DEDE解决无法下载远程图片(远程抓图、存图)到本地?
- title和alt的区别
- 长尾关键词是什么意思呢
- 为什么网站打得开,却ping不通, 网站却打得开
- PHP进阶:设置cookie