4

我读过这$this->getHelper('[helper_name]')$this->_helper->[helper_name]. 我无法找到任何文档是其中哪个更好/更受欢迎:$this->_redirect($url)$this->getHelper('Redirector')->gotoUrl($url).

4

1 回答 1

5

使用适合您的任何一个,他们做的事情完全相同:

/**
 * Redirect to another URL
 *
 * Proxies to {@link Zend_Controller_Action_Helper_Redirector::gotoUrl()}.
 *
 * @param string $url
 * @param array $options Options to be used when redirecting
 * @return void
 */
protected function _redirect($url, array $options = array())
{
    $this->_helper->redirector->gotoUrl($url, $options);
}
于 2011-03-11T14:53:07.270 回答