In a normal action, I do this $this->_forward()
. I want to do the same thing in an action helper. This doesn't work
$this->getActionController()->_forward('');
$this->_actionController()->_forward('');
_forward is a protected function so obviously you can't call it via
$this->getActionController()->_forward('');
The easiest way to make the forward method usable in a public scope is to make a new forward() method (note 'forward' not '_forward) and proxy it to the _forward method:
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);
}
}
Haven't tested it, but it should work Happy hacking.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.