首頁 >後端開發 >php教程 >zf2 module.php中实现redirect

zf2 module.php中实现redirect

WBOY
WBOY原創
2016-06-23 13:41:522225瀏覽

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.
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn