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

yipeiwu_com5年前PHP代码库

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

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

相关文章

php数组中删除元素的实现代码

复制代码 代码如下: <?php $arr = array('a','b','c','d'); unset($arr[1]); print_r($arr); ?> prin...

php google或baidu分页代码

复制代码 代码如下:<?php /** 作者:潇湘博客 时间: 2009-11-26 php技术群: 37304662 使用方法: include_once'Pager.class...

阿里云的WindowsServer2016上部署php+apache

阿里云的WindowsServer2016上部署php+apache

一、说明:项目需要在阿里云的WindowsServer2016上部署web环境,已经安装了Mysql,所以就不用一键安装(如phpstudy或者wamp来安装web环境了),就独立安装了...

JS 网站性能优化笔记

1. 除去JavaScript注释 除了注释,其他所有的 // or /* */ 注释都可以安全删除,因为它们对于最终使用者来说没有任何意义。 2. 除去JavaScript中的空白区域...

PHP用SAX解析XML的实现代码与问题分析

复制代码 代码如下: <?php $g_books = array(); $g_elem = null; function startElement( $parser, $name...