今天在寫引用時突然出現了Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of getimagesize(). 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. However, future versions may not support this any longer錯誤,後來才知道原因是此方法已不被贊成並在 PHP/Zend 未來的版本中很可能不再支持了
解決辦法
第一種方法、 把php.ini的display_errors = on改成display_errors = off (不顯示錯誤)
第二種方法、allow_call_time_pass_reference = Off 變成 allow_call_time_pass_reference = On
上面是對php.ini進行修改,但是如果你沒有權限可以修改程序,下面我舉個簡單的例子
可能出現問題的
代碼如下 復制代碼function test1($a,$b){
$b = "fun_test1";
return;
}
$a = "a_value";
$b = "b_value";
test1($a,&$b);
不會有問題出現
代碼如下 復制代碼function test2($a,&$b){
$b = "fun_test2";
return;
}
$a = "a_value";
$b = "b_value";
test2($a,$b);