这个错误发生在大家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. jsp自定义标签分页

    第一步:建立分页实体page类 package com.soda.util; /** * @description 分页实体类 * @author line * @time 2016年8月28日11: ...

  2. CSS skills: 5) jquery hover(over,out)

    $(":div[name=div_edit]").each(function() { $(this).hover(function() { $(this).find("& ...

  3. Node.js连接Mysql

    1.安装 npm install mysql 注意要复制node_modules到当前工程的文件夹中 2.基本连接 /** * Created by Administrator on 13-12-25 ...

  4. [改善Java代码]使用forName动态加载类文件

    动态加载(Dynamic Loading)是指在程序运行时加载需要的类库文件,对Java程序来说,一般情况下,一个类文件在启动时或首次初始化时会被加载到内存中,而反射则可以在运行时再决定是否需要加载一 ...

  5. poj 2749 2-SAT问题

    思路:首先将hate和friend建边求其次2-SAT问题,判断是否能有解,没解就输出-1,否则用二分枚举最大的长度,将两个barn的距离小于mid的看做是矛盾,然后建边,求2-SAT问题.找出最优解 ...

  6. nineOldAnimation 应用

    Android动画学习笔记-Android Animation   3.0以前,android支持两种动画模式,tween animation,frame animation,在android3.0中 ...

  7. android中Json数据保存方式

    package com.example.savejsonproject; import java.io.File; import java.io.FileNotFoundException; impo ...

  8. BUG修改纪录

    刚进入现在的公司,接手了一个遗留的项目,BUG频出,最近一个星期都在加班改BUG,身心疲惫,为了 现在,将来不会再被相同BUG困扰,特来纪录一下. 1.数据库设计字段时,对于int等类型最好设置默认值 ...

  9. PHP学习笔记 - 进阶篇(2)

    PHP学习笔记 - 进阶篇(2) 函数 1.自定义函数 PHP内置了超过1000个函数,因此函数使得PHP成为一门非常强大的语言.大多数时候我们使用系统的内置函数就可以满足需求,但是自定义函数通过将一 ...

  10. 类的构造器[constructor]_C#

    类的构造器(constructor): 1.       先看两个类定义: class A{ } 相当于: class A: object { Public A ( ) : base( ) {   } ...