Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我有一个控制器,它有一个init设置页面标题的功能,headMeta->appendName然后在一个错误捕获上我想转发到另一个页面,但不是错误控制器,而是同一个控制器上的另一个操作,因此调用 init 两次,有没有解决的办法?
init
headMeta->appendName
您可以Zend_Registry用作标志来检查是否设置了元标记
Zend_Registry
public function init() { if(!Zend_Registry::isRegistered('headMetaSet')) { $this->view->headMeta()->appendName('keywords', 'keys'); Zend_Registry::set('headMetaSet', true); } }