Home  >  Article  >  Backend Development  >  zf2 module.php中实现redirect

zf2 module.php中实现redirect

WBOY
WBOYOriginal
2016-06-23 13:41:522151browse

public function onBootstrap($e){    $e->getApplication()->getEventManager()->getSharedManager()->attach('Zend\Mvc\Controller\AbstractActionController', 'dispatch', function($e) {        $controller = $e->getTarget();        if (something.....) {            $controller->plugin('redirect')->toRoute('yourroute');            <pre class="n">$controller->plugin('redirect')->toUrl($url);

 } }, 100);}
For mor info visit http://framework.zend.com/manual/2.1/en/modules/zend.event-manager.event-manager.html.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn