这个错误发生在大家php调试程序用到一段代码里,那就是格式化显示出变量的函数functionrdump($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的更多相关文章

  1. 已解决:Strict Standards: Only variables should be passed by reference in

    今天安装ecshop的时候最上面出现了一个错误提示:Strict Standards: Only variables should be passed by reference in F:\www.x ...

  2. 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 ...

  3. ECshop Strict Standards: Only variables should be passed by reference in解决办法

    本文章来给各位同学介绍关于ECshop Strict Standards: Only variables should be passed by reference in解决办法,希望此教程 对各位同 ...

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

    出现Strict Standards: Only variables should be passed by reference in的解决方法 代码报错: <br /><b> ...

  5. 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 ...

  6. [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_ ...

  7. php报警:Strict Standards: Only variables should be passed by reference in

    错误原因 因为end函数的原因. end函数: mixed end    ( array &$array   ) 你可以看到end的参数是一个引用(reference),而你只能把一个变量的引 ...

  8. Ecshop提示Only variables should be passed by reference in错误

    Ecshop是个坑爹货,为什么tiandi会说它是个坑爹货呢,请看一下下面的官方的运行环境推荐: 服务器端运行环境推荐·php版本5.0以上5.3以下的版本(推荐使用5.2系列版本)·Mysql版本5 ...

  9. 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 ...

随机推荐

  1. 琐碎-将hadoop源码作为工程导入eclipse

    之前写过如何用eclipse看hadoop源码,虽然非官方版的,但是可以达到目的,最重要是简单方便快速 官方版(hadoop2.2.0)的也有: 源码目录为: 和之前的源码目录有很大的不同 编译的时候 ...

  2. oracle函数、包、变量的定义和使用、重点”结构体和数组”

    函数 实例1:输入雇员的姓名,返回该雇员的年薪 create function fun1(spName varchar2) ,); begin +nvl(comm,) into yearSal fro ...

  3. 分享一个java线程专栏

    专栏 : java线程基础 转载自 http://blog.csdn.net/column/details/yinwenjiethread.html 专栏内容: 1.线程基础:线程(1)--操作系统和 ...

  4. [改善Java代码]非稳定排序推荐使用List

    我们知道Set与List的最大区别就是Set中的元素不可以重复(这个重复指的equals方法的返回值相等),其他方面则没有太大的区别了,在Set的实现类中有一个比较常用的类需要了解一下:TreeSet ...

  5. poj 3678 2-SAT问题

    思路:将每个点拆分为两个点 a与a' ,a表示为1,a'表示为0.那么条件给的每个边自然就会存在矛盾,然后根据2-SAT建边就行了. #include<iostream> #include ...

  6. Activity保持关闭不销毁

    activity按back键 消失但是不销毁的实现 重新定义finish()方法: @Override    public void finish() {        // TODO Auto-ge ...

  7. 转: utf16编码格式(unicode与utf16联系)

    转自: http://www.cnblogs.com/dragon2012/p/5020259.html UTF-16是Unicode字符集的一种转换方式,即把Unicode的码位转换为16比特长的码 ...

  8. git 一个文件还原到某个提交的commit

    git checkout ${commit} /path/to/file 参考文献中1的参考链接中的git-checkout(1) Manual Page 中的Name: git-checkout - ...

  9. 只能在执行 Render() 的过程中调用 RegisterForEventValidation(RegisterForEventValidation can only be called during Render();

    只能在执行 Render() 的过程中调用 RegisterForEventValidation(RegisterForEventValidation can only be called durin ...

  10. CSS3—六边形

    整理了2种方法,看完肯定觉得超简单~ 一.旋转型 话不多说先看下需要的样式: 1.transform:rotate(angle) 2.overflow 3.visibility 效果:演示效果,run ...