php錯誤提示:Call-time pass-by-reference has been deprecated_PHP教程

來源:互聯網
上載者:User
今天在寫引用時突然出現了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);

http://www.bkjia.com/PHPjc/632128.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/632128.htmlTechArticle今天在寫引用時突然出現了Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declar...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.