Zend Controller Action:_redirect()vs getHelper('Redirector') - > gotoUrl()

Son*_*nny 4 redirect zend-framework zend-controller

我读过这个$this->getHelper('[helper_name]')比较好$this->_helper->[helper_name].我无法找到任何文件是哪些更好/首选:$this->_redirect($url)$this->getHelper('Redirector')->gotoUrl($url).

Aro*_*eel 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);
}
Run Code Online (Sandbox Code Playgroud)