LoginSignup
4
5

More than 5 years have passed since last update.

Zend Framework 2 でリダイレクトする際にGETパラメータを渡す Redirect with get parameter on zf2

Posted at

ZendFramework 2 の AbstractActionController には、リダイレクトしてくれる redirect() プラグインがあります。
toRoute()を使うことで、route情報を使ってリダイレクト先を決めることが出来ます。

コントローラ内で、toRoute() してリダイレクトする際、GETパラメータを渡すことが出来ます。

return $this->redirect()->toRoute(
    'routename/childroutename',
    [
        'controller' => 'album',
        'action' => 'index'
    ],
    [
        'query' => [
            'param' => 'value'
        ]
    ]
);
4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5