????? 在尝试Zend Framework的Module Bootstrap时,视图获取View资源对象,但是使用类似下面的代码时,
产生错误:
$this->bootstrap('view'); $view = $this->getResource('view');
?????? 错误信息类似于这个帖子中提问者遇到的:
????? Accessing View object from Module Bootstrap
????? 错误信息类似于:
????? Zend_Application_Bootstrap_Exception: Resource matching "view" not found in ....../library/Zend/Application/Bootstrap/BootstrapAbstract.php
?
????? 根据同贴中的答复者weierophinney的回复,正确的方法应该如同下面的代码:
$bootstrap = $this->getApplication(); $bootstrap->bootstrap('View'); $view = $bootstrap->getResource('View');
?????? 其更多答复做一个截取转贴于下:
When in a module bootstrap, you need to grab it from the application
bootstrap, which, cryptically, you retrieve with the getApplication()
method
?
?