如果在cakephp中注销后阻止访问访问过的页面?

时间:2015-05-16 06:19:02

标签: cakephp-2.0

请回答我的问题。我没有得到满意的答复。

问题是:“如何在cakephp注销后阻止访问访问过的页面?” 在此先感谢

1 个答案:

答案 0 :(得分: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');
    }
}