我已将表单提交 URI 设置为类似的东西,'/register'并且在控制器操作$dispatcher->forward()中设置为'/profile'. 提交表单时,它会转发到正确的页面,但浏览器中显示的 URI 是'/register'. 有没有办法将 URI 设置为在$dispatcher->forward()方法中定义的而不是在表单操作中定义的?
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   回答