从3升级到PHP 5.5之后.x,它似乎试图解析我的JavaScript注释(嵌入在一个PHP包含文件的脚本标签)
After upgrading to PHP 5.5 from 3.x, it seems to be trying to parse my JavaScript comment (embedded in a script tag in a PHP include file)
我在相当长的一段时间内没有使用PHP,但我曾经建立的第一个网站,我用PHP做的,我使用include
的一切。直到网站主机更新了PHP,一切都工作了,现在没有选择恢复到旧版本的PHP。我只需要修复这个奇怪的错误引起的更新到5.5,其中似乎 php试图解析javascript。
所以我使用include
来分隔<head>
部分,并且包含脚本标签的PHP文件如下所示:
scripts.php
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="../js/nav.js"></script>
<script>
.. snip ..
</script>
<script>
var imgId = [
"ip-product-1",
"ip-product-2",
"ip-product-3",
"ip-product-4",
];
var ImageCnt = 0;
function IPnextImage(direction)
{
var i=1;
while(i<5)
{
document.getElementById("ip-product-" + i).style.opacity = "0";
document.getElementById("ip-product-" + i).style.pointerEvents = "none";
i++;
}
// ImageCnt set to: ImageCnt plus (if direction is left)<-1>(else)<1> - in other words, for "left" subtract one from ImageCnt and for "right" add one to it, and then convert this to <%> to keep anything from escaping the maximum or minimum.
ImageCnt = (ImageCnt + (direction == "left" ? imgId.length-1 : 1)) % imgId.length;
document.getElementById(imgId[ImageCnt]).style.opacity = "1";
document.getElementById(imgId[ImageCnt]).style.pointerEvents = "auto";
}
</script>
然后我只使用scripts.php
和include
来形成文档。
但是现在有一个错误:PHP Parse error: syntax error, unexpected '>' in /hermes/waloraweb089/b2700/as.agcomput/AGWebsite1.2/includes/scripts.php on line 73
第73行是:
ImageCnt = (ImageCnt + (direction == "left" ? imgId.length-1 : 1)) % imgId.length;
// ImageCnt set to: ImageCnt plus (if direction is left)<-1>(else)<1> - in other
// words, for "left" subtract one from ImageCnt and for "right" add one to it,
// and then convert this to <%> to keep anything from escaping the maximum or minimum.
在PHP 5.5中发生了什么,这是一个问题,而在PHP 3.x中工作?
当你从PHP 3升级。你很可能得到一个全新的PHP .ini文件,它可能已经启用了asp_tags设置。
还请注意,这个ASP样式标签将从PHP 7.0.0中删除,因此禁用此配置选项是一个安全的选择。
相关文章:
- 如何摆脱"压缩/块”;PHP页面底部的注释
- 在PHP的注释-回复系统中删除某个注释
- ajax/php注释系统不工作
- php脚本在购买的模板中呈现为注释
- Ajax、PHP和mysql注释系统
- 如何在我的php注释框中实时替换带有表情符号的文本
- 如何使用 PHP 删除 JS 注释
- PHP 向评级系统添加注释框
- 带有锚点标签、http:// 或URL的PHP注释以及其余的HTML标签是纯文本
- Perl正则表达式,用于查找和替换php多行注释
- 如何对jquery中有一行php代码的jquery代码块进行注释
- 使用AJAX和PHP永久存储注释
- 在PHP中转义json数据而不使用JS注释hack的正确方法
- 如何用AJAX告诉PHP在文章下面显示哪些注释
- 从3升级到PHP 5.5之后.x,它似乎试图解析我的JavaScript注释(嵌入在一个PHP包含文件的脚本标签)
- 在浏览器中使用PHP对PDF进行注释和绘制,并再次保存为PDF格式
- 使用PHP/Javascript更改Disqus注释中显示的文本
- PHP+AJAX+jQuery注释/回复系统在提取第一个回复后停止工作
- 用PHP和AngularJS加载更多注释
- 删除PHP中所有真实的Javascript注释