我想把 Zend_View 放到 Zend_Registry 中,但我在这个简单的任务中遇到了麻烦。Zend_View 在 application.ini 中被初始化为资源:
resources.view.encoding = "UTF-8"
resources.view.contentType = "text/html; charset=UTF-8"
resources.view.doctype = "HTML4_STRICT"
resources.view.helperPath.ZendX_JQuery_View_Helper = "ZendX/JQuery/View/Helper"
它工作正常,然后我想通过在 Bootstrap.php 中添加方法将其放入注册表中。
protected function _initView()
{
$view = $this->getResource('view');
Zend_Registry::set('view', $view);
return $view;
}
刷新后,我在视图初始化中遇到错误:
Catchable fatal error: Argument 1 passed to ZendX_JQuery::enableView() must be an instance of Zend_View_Interface, null given, called in D:\projekty\xxx\library\ZendX\Application\Resource\Jquery.php on line 91 and defined in D:\projekty\xxx\library\ZendX\JQuery.php on line 104
我究竟做错了什么?我之前没有收到那个 jQuery 错误