可能重复:
引用调用时间传递已被弃用
虽然它可能在互联网上的某个地方被记录下来,但我找不到解决我问题的方法。自PHP 5.4更新以来,传递引用已被删除。
现在我对这部分代码有一个问题,我希望有人能看到我试图用它做什么,这样他们就有可能帮助我解决我的引用传递问题。
以下是有问题的代码:
public function trigger_hooks( $command, &$client, $input ) {
if( isset( $this->hooks[$command] ) ) {
foreach( $this->hooks[$command] as $func ) {
PS3socket::debug( 'Triggering Hook ''' . $func . ''' for ''' . $command . '''' );
$continue = call_user_func( $func, &$this, &$client, $input );
if( $continue === FALSE ) {
break;
}
}
}
}
只有调用时间通过引用被删除。所以改变:
call_user_func($func, &$this, &$client ...
对此:
call_user_func($func, $this, $client ...
无论如何,在PHP4时段之后都不应该需要CCD_ 1。
如果您绝对需要通过引用传递$client,请更新函数($func)签名,而不是(function func(&$client) {
)