2015-05-16 68 views

回答

0

在AppController中beforeFilter

// Check if the user is logged in 
if (isset($this->Auth->user())) { 
    // Save the visited page in session 
    $this->Session->write('VisitedPages.', $this->here()); 
// If the user is not logged in 
} else { 
    // If the user has logged out and visited the page before 
    if (isset($this->Session->read('VisitedPages.'.$this->here()))) { 
     $this->redirect('/errorPage'); 
    } 
}