PHP 中 syntax error, unexpected $end 错误的一种原因及解决
来源:互联网 发布:xbox one 知乎 编辑:程序博客网 时间:2024/05/22 13:59
Parse error: syntax error, unexpected $end in script.php on line xx
调试了一会后发现产生错误的行是文件中间某行
//$str .= "?>/n";
想起来了 PHP 解释器允许的结尾标记那行还可以用单行注释,即 //$str .= "?>/n"; 被解释成结尾标记前有注释,注释的内容是 //$str .= ",而 ?> 后面的 /n"; 会被解释作 PHP 块外的内容按 HTML 输出出去!结果是给 $str .= "?>/n"; 这行添加 // 成注释后,反而多了个 ?> 的结束标记,造成原来真正的结束标记成了意料之外的(unexpected)了。
解决办法就是直接删掉这一行即可。
PHP 开始和结束标记所在行别写其它东西,是个好习惯。
- PHP 中 syntax error, unexpected $end 错误的一种原因及解决
- PHP syntax error, unexpected $end 错误的一种原因及解决
- php的tips(syntax error, unexpected $end错误)
- PHP 解决Parse error: syntax error, unexpected $end问题
- 解决执行脚本报syntax error: unexpected end of file或syntax error near unexpected token `fi'错误的问题
- 解决shell错误:syntax error: unexpected end of file
- 关于PHP Parse Error: syntax error, unexpected $end 错误的解决办法
- 关于PHP Parse Error: syntax error, unexpected $end 错误的解决办法
- 关于PHP Parse Error: syntax error, unexpected $end 错误的解决办法
- syntax error : unexpected end of file 问题的解决
- syntax error, unexpected $end
- php出现如下错误: Parse error: syntax error, unexpected end of file in
- PHP Parse Error: syntax error, unexpected $end 解决方法
- Parse error: syntax error, unexpected $end in ...php
- PHP关于syntax error语法错误的问题(Parse error: syntax error, unexpected end of file in xxxxxxxx)
- SHELL syntax error:unexpected end of file 提示错误
- Shelll 错误 syntax error: unexpected end of file
- Shelll 错误 syntax error: unexpected end of file
- 怎么解决 “你输入的地址无法解析”?
- Makefile学习教程
- 动力
- Struts2.0的异常
- Java:使用Executors创建和管理线程
- PHP 中 syntax error, unexpected $end 错误的一种原因及解决
- SVN 服务器镜像
- “自增字段”的恢复
- Enterprise Library Configuration的使用
- 害死人的ddos,价格屠夫安易ES系列抗DDOS硬件防火墙
- 1个可以防止刷新的JSP计数器
- 设计模式笔记(一)
- 关于路由表和ACL
- js验证是否只能输入数字