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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

  2021-03-29 我要评论
想了解php 出现Strict Standards: Only variables should be passed by reference in的解决办法的相关内容吗,在本文为您仔细讲解Strict Standards的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:Strict,Standards,下面大家一起来学习吧。

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

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

猜您喜欢

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们