jalpesh 和 Hasina 的简短回答都是正确的。
Jalpesh 的示例是对动作助手 redirector() 的简写调用,默认为 gotoSimple() 重定向方法,但他似乎将参数向后设置。
//corrected
$this->_helper->redirector($action, $controller);
更详细地称为:
$this->getHelper('Redirector')->gotoSimple($action, $controller = null, $module = null, array $params = array());
Redirector action helper有多种使用方式,这只是一个非常常见的例子。
Hasina 提供的示例是对控制器 utility method _redirect() 的调用,这是一段比 Redirector 帮助器更有限的代码,但仍然非常有用。
//only accepts a url string as the first arg
//deprecated as of ZF 1.7 still in documentation
$this->_redirect($url, array $options = array());
显然,从 ZF 1.7 开始,有一种新方法不在文档中(在文档块中找到此位),这是首选:
//valid as of ZF 1.7, not in documentation
$this->redirect($url, array $options = array());
这两种实用方法都是以下方面的代理:
Zend_Controller_Action_Helper_Redirector::gotoUrl()
希望对你有帮助