解决Strict Standards: Only variables should be passed by reference
这个错误发生在大家php调试程序用到一段代码里,那就是格式化显示出变量的函数function
rdump(
$arr
)的第5行
, 这段代码出自ecmall团队之手,但是ecmall已经很古董了,在php5.3以上版本会出这个问题,应该也和php的配置有关,只要把这一句拆成两 句就没有问题了。因为array_walk的参数是引用传递的,5.3以上默认只能传递具体的变量,而不能通过函数返回值。当然你也可以修改 php.ini 里的 error_reporting = E_ALL | E_STRICT,但这终究不符合规范。
有问题的代码:
<?php
function rdump($arr)
{
echo '<pre>';
array_walk(func_get_args(), create_function('&$item, $key', 'print_r($item);'));
echo '</pre>';
exit();
} $arr = array(1, 2, 3);
rdump($arr);
推荐修改为:
<?php
function rdump($arr)
{
echo '<pre>';
$array = func_get_args();
array_walk($array, create_function('&$item, $key', 'print_r($item);'));
echo '</pre>';
exit();
} $arr = array(1, 2, 3);
rdump($arr);
最终可以完美不报错:
解决Strict Standards: Only variables should be passed by reference的更多相关文章
- 已解决:Strict Standards: Only variables should be passed by reference in
今天安装ecshop的时候最上面出现了一个错误提示:Strict Standards: Only variables should be passed by reference in F:\www.x ...
- ECShop出现Strict Standards: Only variables should be passed by reference in的解决方法
今天安装ecshop的时候最上面出现了一个错误提示:Strict Standards: Only variables should be passed by reference in F:\www.x ...
- ECshop Strict Standards: Only variables should be passed by reference in解决办法
本文章来给各位同学介绍关于ECshop Strict Standards: Only variables should be passed by reference in解决办法,希望此教程 对各位同 ...
- 出现Strict Standards: Only variables should be passed by reference in的解决方法
出现Strict Standards: Only variables should be passed by reference in的解决方法 代码报错: <br /><b> ...
- Strict Standards: Only variables should be passed by reference
<?php $tag="1 2 3 4 5 6 7"; $tag_sel = array_shift(explode(' ', $tag)); print_r($tag_se ...
- [php-error-report]PHP Strict Standards: Only variables should be passed by reference
// 报错代码:PHP Strict Standards: Only variables should be passed by reference $arr_userInfo['im_nation_ ...
- php报警:Strict Standards: Only variables should be passed by reference in
错误原因 因为end函数的原因. end函数: mixed end ( array &$array ) 你可以看到end的参数是一个引用(reference),而你只能把一个变量的引 ...
- Ecshop提示Only variables should be passed by reference in错误
Ecshop是个坑爹货,为什么tiandi会说它是个坑爹货呢,请看一下下面的官方的运行环境推荐: 服务器端运行环境推荐·php版本5.0以上5.3以下的版本(推荐使用5.2系列版本)·Mysql版本5 ...
- MagicZoom bug-Strict Standards: Only variables should be assigned by reference Error
问题:zencart Strict standards: Only variables should be assigned by reference in jscript_zen_magiczoo ...
随机推荐
- PHP.2-LAMP平台介绍及网站的工作原理
LAMP平台介绍及网站的工作原理 1.HTTP协议 URL(UniformResourceLocator)统一资源定位符,就是网页地址的意思.[格式:协议://主机.端口.文件.附加资源] ##URL ...
- font拓展字体
最近接触了一个将字体拓展的方法,感觉很不错,所以积累一下. 最近接触的项目一直再用antd,它本身已经提供了很多图标,但是依然不够用,所以需要我们拓展出来一些. 当我们下载到本地之后,就会有几个文件, ...
- Codeforces Round 190 div.2 322C 321A Ciel and Robot
唔...这题是数学题. 比赛时做出来,但题意理解错了,以为只要判断那点是不是在线上就行了,发现过不了样例就没提交. 思路:记录每一步的偏移,假设那点是在路径上的某步,然后回推出那一个周期的第一步,判断 ...
- 安装 tomat
(1)新建一个文件夹放置要下载的tomcat: mkdir /software 进入software目录 cd /software (2)下载tomcat放置在software目录下 wget ht ...
- LeetCode 42
Trapping Rain Water Given n non-negative integers representing an elevation map where the width of e ...
- (转)linuxmint,ubuntu 下修改guake宽度方法
之前在网上找到修改guake.py的方式,但是我一直没能找到guake.py的文件,弄的我纠结,后来找到这个文章,这个确实是有效果的 Ubuntu12.04上Guake在唤出的时候滚动条会消失,主要原 ...
- Jersey(1.19.1) - Representations and Java Types
Previous sections on @Produces and @Consumes referred to MIME media types of representations and sho ...
- namenode无法启动(namenode格式化失败)
格式化namenode root@node04 bin]# sudo -u hdfs hdfs namenode –format 16/11/14 10:56:51 INFO namenode.Nam ...
- Contoso 大学 - 8 – 实现继承
原文 Contoso 大学 - 8 – 实现继承 By Tom Dykstra, Tom Dykstra is a Senior Programming Writer on Microsoft's W ...
- SQL中CONVERT()函数用法详解
SQL中CONVERT函数格式: CONVERT(data_type,expression[,style]) 参数说明: expression 是任何有效的 Microsoft® SQL Server ...