当前位置: 移动技术网 > IT编程>开发语言>PHP > php 出现Strict Standards: Only variables should be passed by reference in的解决方法

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

2017年12月08日  | 移动技术网IT编程  | 我要评论

朱明国文强称兄道弟,哈佛商业评论 pdf,18.66.110.27

这个问题多半是因为引用传递参数引起的,解决办法一是修改代码不使用引用传递;另一个办法是修改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文件中发现下面这段代码:

$tag_sel = array_shift(explode(' ', $tag));

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

$tagarr = explode(' ', $tag);
$tag_sel = array_shift($tagarr);

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

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

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

修改方法:

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

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

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网