只应通过引用传递变量 - socket_select()

spi*_*dEY 6 php sockets

我的类中有一个函数,它使用了socket_select()函数,我注意到它抛出了这个警告:

Strict Standards: *Only variables should be passed by reference*
Run Code Online (Sandbox Code Playgroud)

这就是我使用它的方式,是的,我确实在PHP手册中阅读了"使用NULL和socket_select()的示例#1"

$read = array($this->socket);
$write = NULL;
$except = NULL;

socket_select($read, $write, $except, 0, $this->socket_timeout);
Run Code Online (Sandbox Code Playgroud)

在while循环中调用函数时,这会导致大量错误垃圾邮件.当然,我可以抑制E_STRICT错误,但我想知道这里的确切问题是什么.我的PHP版本是5.3.5

小智 1

也许它不喜欢 NULL 引用?

我会尝试:

$read = array($this->socket);
$write = array();
$except = array();
Run Code Online (Sandbox Code Playgroud)