请回答我的问题。我不会得到令人满意的答案。
问题是:"在CakePHP中注销后如何防止访问访问的页面?"预先感谢
在appcontroller 之前,:
// 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');
}
}