Zend Controller Action: _redirect() vs getHelper('Redirector')->gotoUrl()
I've read that $this->getHelper('[helper_name]')
is preferable to $this->_helper->[helper_name]
. 开发者_如何学JAVA What I haven't been able to find any documentation of is which of these is better/preferred: $this->_redirect($url)
or $this->getHelper('Redirector')->gotoUrl($url)
.
Use whatever one suits you, they do exactly the same thing:
/**
* 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);
}
精彩评论