退出页面后防止返回按钮 [英] prevent back button after logout page

查看:80
本文介绍了退出页面后防止返回按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有php注销页面.当用户单击注销链接时,请参阅此页面并重定向到索引页面.但是当单击后退按钮时,我会看到包含用户数据的上一页.当然,当我刷新页面时,我看不到先前的页面和数据.单击注销并单击后退按钮后,我检查了其他代码(drupal),我没有看到上一页,也没有看到登录页面.我的问题在哪里.如何解决这个问题?

I Have php logout page. when user click in logout link See this page and redirect to index page. but when click in back button i see previouse page with user data. of course when i refresh page i dont see previouse page and data. i checked other code ( drupal ) after click logout and click back button i dont see previouse page and see login page. Where is my problem. how to fixed this ?

注销页面:

if (isset($_GET['req']) && $_GET['req'] == 'logout') {
      session_start();
      session_destroy();
      header("Location: index.php");
   exit();
}

谢谢

推荐答案

我认为这主要是客户端问题,并且归因于浏览器缓存标头.

I think this is mostly client side issue and due to browser cache headers .

解决方法是什么?

我认为您需要为静态内容和非静态内容正确设置缓存头

In my opinion you need to set cache headers for static content and non-static contents properly

静态内容(css/javascript/images):阅读此内容

Static contents (css/javascript/images ): read this

对于php页面本身:header("Cache-Control", "no-store, no-cache, must-revalidate");

For php page itself: header("Cache-Control", "no-store, no-cache, must-revalidate");

应该可以解决问题

这篇关于退出页面后防止返回按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆