【问题标题】:Symfony 2.6 logout back button (CakePHP)Symfony 2.6 注销后退按钮 (CakePHP)
【发布时间】:2015-07-11 09:39:28
【问题描述】:

在尝试了很多不同的方法(成功处理程序、缓存指令、更改路由、覆盖方法等)之后,我无法注销用户(使用 FOSUserBundle),这使她在按下时无法查看以前的页面浏览器的后退按钮。

有没有办法在 Symfony 2.6 中做到这一点?

在 CakePHP 中,这在 Controller 中完美运行

public function logout() {

    session_destroy();
    $this->Auth->deny('*');
    $this->Auth->shutdown('*');
    $this->Session->setFlash('Logout succesful - no back button issue.');
    return $this->redirect($this->Auth->logout());

}

【问题讨论】:

    标签: php symfony cakephp model-view-controller browser-cache


    【解决方案1】:

    将以下标题添加到应用程序的页面顶部:

     header("Cache-Control: no-cache, no-store, must-revalidate"); 
     header("Pragma: no-cache");
     header("Expires: 0");
    

    【讨论】:

      【解决方案2】:

      您需要向浏览器发送 no-cache 指令 试试这个解决方案https://stackoverflow.com/a/41566590/1154919

      【讨论】:

        【解决方案3】:

        您可以重定向到注销页面:

        return $this->redirectToRoute('fos_user_security_logout');
        

        【讨论】:

          猜你喜欢
          • 2012-05-12
          • 2011-08-05
          • 2013-09-21
          • 2023-03-29
          • 2014-08-14
          • 2013-12-11
          • 2011-03-26
          • 2018-08-03
          • 1970-01-01
          相关资源
          最近更新 更多