Zend Framework 2 Redirect

后端 未结 4 2493
鱼传尺愫
鱼传尺愫 2021-02-20 17:26

How can I redirect to another module?

return $this->redirect()->toRoute(null, array(
    \'module\'     => \'othermodule\',
    \'controller\' => \'s         


        
4条回答
  •  你的背包
    2021-02-20 17:45

    This is how I redirect from my Controller to another Route:

    return $this->redirect()->toRoute('dns-search', array(
        'companyid' => $this->params()->fromRoute('companyid')
    ));
    

    Where dns-search is the route I want to redirect to and companyid are the url params.

    In the end the URL becomes /dns/search/1 (for example)

提交回复
热议问题