Cakephp在登录后自动重定向到预期页面

Cakephp在登录后自动重定向到预期页面,php,cakephp,Php,Cakephp,在CakePHP2.0.6中 我正试图使它,以便用户得到重定向到页面,他/她打算去之前登录,以便在登录后,它重定向到该页面 我正在一起使用jQuery Mobile和Cakephp框架 public function login(){ $this->layout = 'jquery-mobile'; if ($this->request->is('post')) { if ($this->Auth->login

在CakePHP2.0.6中

我正试图使它,以便用户得到重定向到页面,他/她打算去之前登录,以便在登录后,它重定向到该页面

我正在一起使用jQuery Mobile和Cakephp框架

public function login(){
        $this->layout = 'jquery-mobile';
        if ($this->request->is('post')) {
            if ($this->Auth->login()) {
                return $this->redirect($this->Auth->redirect());
            } else {
                $this->Session->setFlash(__('Username or password is incorrect'), 'default', array(), 'auth');
            }
        }
    }
上述功能有时似乎可以正常工作,但并非始终如此


在成功登录到登录页控制器后,我是否可以做些什么来确保它始终发生?

试试这个

// Render the element in /homepage.ctp
   $this->render('homepage');

不工作时会发生什么?