这个错误发生在大家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. isa-swizzling 是什么鬼?

    刚看到这个名字估计很多人有点熟悉,Method Swizzling对不对,不熟悉也没关系,去看看之前的一篇文章黑魔法之Method Swizzling吧.不过也可以根据名称猜测出来所谓的isa-swi ...

  2. 12096 - The SetStack Computer UVA

    Background from Wikipedia: \Set theory is a branch of mathematics created principally by the German ...

  3. ISO8583报文解析

    在此只写了一个8583报文的拆包,组包其实也差不多的. 不多说直接上文件, 具体思路过程,在解析类里面写的有. 其中包含了四个文件 8583resp.txt报文 ISO8583medata配置文件 B ...

  4. cocos2d-x混合BlendFunc的使用

    1.什么是混合模式 “混合”是指两种颜色的叠加方式.在新图片将要渲染画到屏幕上的时候,将用在新图片中的红.绿.蓝和透明度信息,与屏幕上已经存在的图片颜色信息相融合. 说的具体一点,就是把某一像素位置上 ...

  5. byte[] bytes和string转换

    public static string ToHexString ( byte[] bytes ) // 0xae00cf => "AE00CF "        {     ...

  6. 无法挂载 “7.9 GB Filesystem”.

    有个8G的U盘,格式化成exfat格式.插入电脑后点击盘符,弹出错误提示: 无法挂载 “7.9 GB Filesystem”. Error mounting: mount exited with ex ...

  7. Oracle 经典语法(二)

    --提示:工资 = 薪金 + 佣金 1. 找出EMP表中的姓名(ENAME)第三个字母是A 的员工姓名.SELECT ENAME FROM SCOTT.EMP WHERE ENAME LIKE '__ ...

  8. Ubuntu环境下配置Nginx

    /etc/nginx目录文件下: drwxr-xr-x   5 root root 4096 Apr 27 12:47 ./ drwxr-xr-x 104 root root 4096 Apr 27 ...

  9. 给jdk写注释系列之jdk1.6容器(1)-ArrayList源码解析

    工作中经常听到别人讲“容器”,各种各样的容器,话说到底什么是容器,通俗的讲“容器就是用来装东西的器皿,比如:水桶就是用来盛水的,水桶就是一个容器.” ok,在我们写程序的时候常常要对大量的对象进行管理 ...

  10. 使用CSS实现一个简单的幻灯片效果

    方法一: 简单的CSS代码实现幻灯片效果 方法二: 使用CSS3 Animation来制作幻灯片 方法一: 简单的CSS代码实现幻灯片效果 话不多说,直接上代码 <!DOCTYPE html&g ...