我如何呼叫forward in action helper


How can I call forward in action helper

在正常操作中,我这样做$this->_forward()。我想在动作助手中做同样的事情。这行不通

$this->getActionController()->_forward('');
$this->_actionController()->_forward('');

_forward是一个受保护的函数所以显然你不能通过

调用它
$this->getActionController()->_forward('');

使forward方法在公共作用域中可用的最简单方法是创建一个新的forward()方法(注意'forward'而不是'_forward)并将其代理给_forward方法:

class App_Controller_Action extends Zend_Controller_Action
{
    public function forward($action, $controller = null, $module = null, array $params = null)
    {
        return $this->_forward($action, $controller, $module, $params);
    }
}

还没有测试过,但应该可以快乐的黑客。