Zend Framework 2: How to place a redirect into a module, before the application reaches a controller

后端 未结 4 1415
礼貌的吻别
礼貌的吻别 2020-12-28 21:19

Let\'s say we have a module named Cart and want to redirect users if some condition is met. I want to place a redirect at the module bootstrapping stage, before the applicat

4条回答
  •  半阙折子戏
    2020-12-28 21:50

    Can you try this.

    $front = Zend_Controller_Front::getInstance();
    $response = new Zend_Controller_Response_Http();
    $response->setRedirect('/profile');
    $front->setResponse($response);
    

提交回复
热议问题