加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php错误提示:Call-time pass-by-reference has been deprecated

发布时间:2020-12-13 20:27:11 所属栏目:PHP教程 来源:网络整理
导读:今天在写引用时突然出现了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-

今天在写引用时突然出现了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进行修改,但是如果你没有权限可以修改程序,下面我举个简单的例子,可能出现问题的代码如下:

  1. function test1($a,$b){ 
  2. $b = "fun_test1"
  3. return
  4. $a = "a_value"
  5. $b = "b_value"
  6. test1($a,&$b); 

不会有问题出现代码如下:

  1. function test2($a,&$b){ 
  2. $b = "fun_test2"
  3. return
  4. $a = "a_value"
  5. $b = "b_value"
  6. test2($a,$b); 

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读