【发布时间】:2013-07-01 16:14:06
【问题描述】:
我得到了这个:
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;
}
如您所见,我使用Closure::bind(),因为它在manual 中显示。请注意,我使用的是\Closure::bind()(注意斜线),因为我使用命名空间自动加载,需要通知自动加载器它应该查看系统命名空间。
注意
仔细查看文档中的每个类,并注意每个细节:)
【问题讨论】:
-
你使用的是什么版本的 PHP?
-
您的服务器上的 PHP 版本是什么?
-
版本 5.3.16 在本地主机上
-
@DaGhostmanDimitrov:你的问题就在那里!你需要 5.4 才能工作。
-
然后看我的回答:]