导航首页 » 技术教程 » php 出现Strict Standards: Only variables should be passed by reference in的解决方法
php 出现Strict Standards: Only variables should be passed by reference in的解决方法 143 2023-12-08   

这个问题多半是因为引用传递参数引起的,解决办法一是修改代码不使用引用传递;另一个办法是修改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.comcls_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));

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



!!!站长长期在线接!!!

网站、小程序:定制开发/二次开发/仿制开发等

各种疑难杂症解决/定制接口/定制采集等

站长微信:lxwl520520

站长QQ:1737366103