/mod/con/act というURLにリダイレクトしたいと思った時の toRoute の1つ目のパラメータ $route の指定方法がちょっと不明だったので、メモ。
最初こんな風に書いてみた。。
return $this->redirect()->toRoute('/mod/con/act');
return $this->redirect()->toRoute('mod/con/act');
ん~ どちらもダメ。。
正解は
return $this->redirect()->toRoute('mod\con', array('action'=>'act'));
'mod\con' これは module.config.php で下記のように定義している。
'mod\con' => array(
'type' => 'segment',
'options' => array(
'route' => '/mod/con[/:action]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9]*',
),
'defaults' => array(
'controller' => 'Mod\Controller\Con',
),
),
),
0 件のコメント:
コメントを投稿