PHP Closure类给出致命错误?

DaG*_*rov 0 php closures

我得到这个:

PHP致命错误:调用未定义的方法Closure :: bind()

我收到错误的行是:

public function bind($signal, $callback)
{

    if (!array_key_exists($signal, $this->_registry))
        $this->_registry[$signal] = array();
    $this->_registry[$signal][] = \Closure::bind($callback, null, 'static'); // here

    return $this;
}
Run Code Online (Sandbox Code Playgroud)

如您所见,我使用手册中Closure::bind()显示的内容.请注意我正在使用(注意斜杠),因为我使用命名空间自动加载,需要通知自动加载器它应该查看系统命名空间.\Closure::bind()

注意

仔细查看文档中的每个类,并注意每个细节:)

Hal*_*zed 5

检查你的php版本,显然你不在> = 5.4.0!