开发者

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

开发者 https://www.devze.com 2023-02-16 11:33 出处:网络
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

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);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消