フォーム送信 URI を次のように設定'/register'
し、コントローラー アクション$dispatcher->forward()
を に設定しました'/profile'
。フォームを送信すると、正しいページに転送されますが、ブラウザに表示される URI は'/register'
. $dispatcher->forward()
フォーム アクションではなく、メソッドで定義されたものに URI を設定する方法はありますか?
1 に答える
1
メソッドを使用できますredirect
。
したがって、コントローラーで次のことができます。
public function registerAction()
{
$this->view->disable();
if ($this->request->isPost()) {
// Here is where you process the POST and check the user
if ($user) {
// Valid user
$this->flash->success('OK');
return $this->response->redirect('profile');
} else {
$this->flash->error('Oops! Something went wrong.');
}
}
}
于 2013-02-25T16:22:41.170 に答える