PHP Fatal error: Cannot pass parameter 2 by reference

PHP Fatal error:  Cannot pass parameter 2 by reference in

这个错误的意思是:不能按引用传递第2个参数

我的理解是: 方法的第2个参数 需要传递的一个变量

本地的PHP为 5.4.35

我出现的情况是如下:

 1 <?php
 2
 3 function test($param1,&$param2){
 4   $param2++;
 5 }
 6
 7 //这样的方式调用,会显示 Fatal error: Only variables can be passed by reference in /var/www/html/test.php on line 9
 8 //因为第二个参数不是一个变量
 9 //test(1,1);
10
11 //在不修改方法的情况下
12 //正确的方法是,将第二个参数的值,存放在一个变量中,如
13 $param3 = 1;
14 test(1,$param3);
15 //现在$param3的值是2了

随笔参考了:

  1. 引用传递
  2. 【PHP错误】Cannot pass parameter 2 by reference
  3. Fatal error: Cannot pass parameter 2 by reference
时间: 2024-11-12 01:19:52

PHP Fatal error: Cannot pass parameter 2 by reference的相关文章

解决FATAL: Error inserting ip_vs ... Unknown symbol in module, or unknown parameter

在使用yum install ipvsadm -y安装lvs管理工具后,发现指令ipvsadm相关指令一直报错: FATAL: Error inserting ip_vs (/lib/modules/2.6.32-358.18.1.el6.x86_64/kernel/net/netfilter/ipvs/ip_vs.ko): Unknown symbol in module, or unknown parameter (see dmesg) Can't initialize ipvs: Prot

FATAL ERROR: Could not find ./bin/my_print_default

网上很多方法都是:/usr/local/mysql/scripts/mysql_install_db --user=mysql 但是很有可能报错,找不到bin目录中的my_print_defaults 错误信息: FATALERROR:Couldnotfind./bin/my_print_defaults If you are using a binary release, you must run this script from within the directory the archiv

ubuntu下安装mysql出现FATAL ERROR: Could not find mysqld的处理

ubuntu下安装mysql出现FATAL ERROR: Could not find mysqld的处理 错误信息: #./bin/mysql_install_db –user=mysql FATAL ERROR: Could not find mysqld The following directories were searched: /usr/libexec /usr/sbin /usr/bin If you compiled from source, you need to run '

FATAL ERROR: Could not find ./bin/my_print_defaults

我勒个去,上午刚搞好MySQL的编译安装,玛德一重启计算机然后重启服务又报错: [[email protected] mysql-5.5.13]# /usr/local/mysql/scripts/mysql_install_db --user=mysql If you compiled from source, you need to run 'make install' to copy the software into the correct location ready for oper

Fatal error encountered during command execution

MySQL + .net + EF 开发环境,调用一处sql语句报错: Fatal error encountered during command execution[sql] view plain copy print?SELECT @r AS cateid,(SELECT @r := b.ParentId FROM cmscontentcategory b WHERE b.id = cateid) AS parentid FROM (SELECT @r := '75422ccd151c48

FATAL ERROR: Could not find ./share/fill_help_tables.sql

[[email protected] mysql-5.6.33]# /apps/mysql-5.6.33/scripts/mysql_install_db --datadir=/data/my_db --user=mysql FATAL ERROR: Could not find ./share/fill_help_tables.sql If you compiled from source, you need to run 'make install' to copy the software

FATAL ERROR: Could not find ./bin/my_print_defaults 解决方法

FATAL ERROR: Could not find ./bin/my_print_defaults If you compiled from source, you need to run 'make install' tocopy the software into the correct location ready for operation. If you are using a binary release, you must either be at the toplevel o

[生产环境数据恢复]innobackupex: fatal error: OR no &amp;#39;datadir&amp;#39; option in group &amp;#39;mysqld&amp;#39; in MySQL options

1 运行恢复命令  [[email protected] tmp]$ time /usr/bin/innobackupex --rsync --user="user" --password="#xxx$" /mysqldata/shared/backup [--rsync ] 能够记录master点,以便进行复制设置. InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy

PHP配置问题:AppServ安装discuz出错 Fatal error:

 Fatal error: Call to undefined function set_magic_quotes_runtime() in  D:\AppServ\www\wp-settings.php on line 27 打开C:\WINDOWS\php.ini 大约在 428 行位置,将magic_quotes_runtime 改为 Off.也就是 magic_quotes_runtime = Off 如果前面有注释的分号,也将它删掉.然后重启 Apache 服务. 打开你的 wp 目录