php 出现Strict Standards: Only variables should be passed by reference in的解决方法

前端之家收集整理的这篇文章主要介绍了php 出现Strict Standards: Only variables should be passed by reference in的解决方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

这个问题多半是因为引用传递参数引起的,解决办法一是修改代码不使用引用传递;另一个办法是修改PHP配置文件修改error_reporting 其值改为error_reporting = E_ALL& ~E_NOTICE。或者修改函数中的引用方式即可。

ps:修改配置文件时,最好是复制一行,注掉,然后再改,如果需要随时切回。

ECShop出现Strict Standards: Only variables should be passed by reference in的解决方法

今天安装ecshop的时候最上面出现了一个错误提示:Strict Standards: Only variables should be passed by reference in F:\www.xxxx.com\cls_template.PHP on line 418

解决办法:

打开cls_template.PHP文件中发现下面这段代码

PHP;"> $tag_sel = array_shift(explode(' ',$tag));

忘记说了,我的PHP版本是5.4.19,PHP5.3以上默认只能传递具体的变量,而不能通过函数返回值传递,所以这段代码中的explode就得移出来重新赋值了

PHP;"> $tagArr = explode(' ',$tag); $tag_sel = array_shift($tagArr);

这样之后顶部的报错没掉了,左侧和底部的报错还需要去ecshop的后台点击清除缓存才能去除

下面我们遇到这段代码,在PHP5.3以上版本,也会报错误

PHP;"> $file_suffix = strtolower(array_pop(explode('.',$file_name)));

修改方法

PHP;"> $fnarray=explode('.',$file_name); $file_suffix = strtolower(array_pop($fnarray));

这样大家就了解了吧,以后传参需要单独写好,不能一行写完了。

原文链接:https://www.f2er.com/php/16900.html

猜你在找的PHP相关文章