沈阳手机网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

沈阳手机网手机维修培训中心Apple手机报价沈阳二手笔记本报价

二手手机回收

沈阳手机靓号DJ音乐 最好听的DJ
查看: 1083|回复: 0

Warning: Call-time pass-by-reference has been deprecated解决方法

[复制链接]
发表于 2019-10-24 00:58:43 | 显示全部楼层 |阅读模式
/*
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. ind:\vhost\include\inc_custom_fields.php on line178
*/


我把php.ini的display_errors = on改成display_errors = off // (不显示错误)
就不显示了。

虽然没有什么影响。但是心里还是有个疙瘩。。。
百度上没有找到什么答案,然后在google上 找到了。

修改php.ini就可以了。

1. 在PHP.ini中搜索关键字 : allow_call_time_pass_reference 没有的自行建立。
2. 将 Off 改成 On ,Web Server重起就OK了~

allow_call_time_pass_reference = Off 变成 allow_call_time_pass_reference = On


ps


文档注解为:


是否启用在函数调用时强制参数被按照引用传递。此方法已不被赞成并在 PHP/Zend 未来的版本中很可能不再支持。鼓励使用的方法是在函数定义中指定哪些参数应该用引用传递。鼓励大家尝试关闭此选项并确保脚本能够正常运行,以确保该脚本也能在未来的版本中运行(每次使用此特性都会收到一条警告,参数会被按值传递而不是按照引用传递)。

在函数调用时通过引用传递参数是不推荐的,因为它影响到了代码的整洁。如果函数的参数没有声明作为引用传递,函数可以通过未写入文档的方法修改其参数。要避免其副作用,最好仅在函数声明时指定那个参数需要通过引用传递。


要引用传入参数,可以两种方法;


  • 1







  • function test1($a,$b){







  • $b = "fun_test1";







  • return;







  • }







  • $a = "a_value";







  • $b = "b_value";







  • test1($a,&$b);















  • 2,







  • function test2($a,&$b){







  • $b = "fun_test2";







  • return;







  • }







  • $a = "a_value";







  • $b = "b_value";







  • test2($a,$b);



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|沈阳手机网 ( 辽ICP备11004416号 )

GMT+8, 2024-4-27 20:25 , Processed in 0.024470 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表