<?php
class tests{
public function __call($m, $args)
{
//$m = test
call_user_func_array($m,$args);
}
// 移除test方法后会报错..
public function test(&$a){
$a = $a + 1000;
}
}
// run.
function test(&$a){
$a ++;
}
$cls = new tests();
$a = 100;
$cls->test($a);
//test($a); // 101
echo ($a);
?>
1: call_user_func_array 优先调用自身的方法? 不需要加类对象?
2: 移除类test方法后, 让它调用test函数. 会报错误.
Warning: Parameter 1 to test() expected to be a reference, value given i
请问, 怎么才能够让它调用引用函数?
你不看文档吗,里面说了call_user_func和call_user_func_array不能按引用传参的