Home > php教程 > php手册 > body text

解决Fatal error: Call-time pass-by-reference has bee

WBOY
Release: 2016-06-06 20:09:36
Original
1839 people have browsed it

今天在使用PHP 5.4.15 版本时遇到这个错误: Fatal error : Call-time pass-by-reference has been removed in /opt/lampstack-5.4.15-0/apps/lixiphp/htdocs/function.inc on line 161 产生这个错误原因是在PHP函数语句中使用来引用变量。比如: foo($varia

今天在使用PHP 5.4.15 版本时遇到这个错误:

Fatal error: Call-time pass-by-reference has been removed in /opt/lampstack-5.4.15-0/apps/lixiphp/htdocs/function.inc on line 161

产生这个错误原因是在PHP函数语句中使用&来引用变量。比如:

foo(&$variable);

实际上,这样用法在PHP 5.3 中就会有提示,只是之前的仅仅会提示Deprecated而已。

简单一句话,调用函数时不需要传递引用变量。

正确用法

函数语句中不需要使用引用变量。
Copy after login
myFunc($var);//Call myFunc
function myFunc(&$arg) { do something... }???? 
Copy after login

错误用法

myFunc(&$arg);//Call myFunc 
function myFunc($arg) { do something... }? 
Copy after login

屏蔽错误显示

error_reporting(0); 
ini_set('display_errors', 'off');
Copy after login

运行时环境:

php-5.4.15 使用PHP 5.4.15 版本

(...)
Read the rest of 解决Fatal error: Call-time pass-by-reference has been removed (9 words)


© lixiphp for LixiPHP, 2013. | Permalink | No comment | Add to del.icio.us
Post tags: PHP 5.4, reference. 引用

Feed enhanced by Better Feed from Ozh

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!