Zend Controller Action: _redirect () vs getHelper ('Redirector') & # 8594; gotoUrl ()

I read that $this->getHelper('[helper_name]') preferable to $this->_helper->[helper_name] . What I could not find in the documentation is whether this is better / preferable: $this->_redirect($url) or $this->getHelper('Redirector')->gotoUrl($url) .

+4
source share
1 answer

Use what suits you, they do the same:

 /** * 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); } 
+5
source

Source: https://habr.com/ru/post/1343332/


All Articles