首页 > 技术文章 > Warning: Call-time pass-by-reference has been deprecated

crazelee 2014-10-30 19:03 原文

今天出现的问题:

Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of in_array_two_dimension(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in D:\wamp\www\myApriori.php on line 48

是因为在函数中传递引用。提示在php.ini文件中开启allow_call_time_pass_reference。

原本 改off为ON,重启,解决。

 

PHP Fatal error:  Call-time pass-by-reference has been removed; If you would like to pass argument by reference, modify the declaration of in_array_two_dimension().

由下面的方法一转变成方法二

 1 //方法一:
 2 function test($a,$b)
 3 {code}
 4 $a_var = 'xx';
 5 $b_var = 'yy';
 6 test(&$a_var, $b_var);
 7 
 8 //方法二:
 9 function test(&$a, $b)
10 {code}
11 $a_var = 'xx';
12 $b_var = 'yy';
13 test($a_var, $b_var);

 

推荐阅读