欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

zf2 module.php中实现redirect

程序员文章站 2022-05-16 21:25:09
...
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');            
$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.