我正在執行動作助手的preDispatch方法中的ACL檢查。當它失敗時,我想調用操作控制器的_redirect方法,但是我很難做到這一點。Zend Framework - 如何從動作助手內部調用controller的重定向()
在附加到這篇文章的評論中,我看到了兩個解決方案:zend-framework, call an action helper from within another action helper。在第一個中,控制器是通過$ this - > _ actionController從助手中訪問的。在第二個中,它使用$ this-> getActionController()來訪問。
我嘗試以下兩個:
$this->_actionController->_redirect('/');
$this->getActionController()->_redirect('/');
在這兩種情況下,我得到「方法‘_redirect’不存在......」。是否可以限制哪些控制器方法可以從動作助手訪問?