简体   繁体   English

注销按钮不清除缓存值

[英]logout button not clearing cache values

I have a logout.php which runs the following code. 我有一个logout.php运行以下代码。 But it does not clear the session values completely. 但是它不能完全清除会话值。 It redirects me to the homepage as it should. 它将我重定向到主页。 But when I click on back button then the previous page is displayed perfectly. 但是,当我单击“后退”按钮时,上一页会完美显示。 I want to remove the cache values. 我想删除缓存值。 How to do it?? 怎么做?? Please help 请帮忙

 <?php session_start(); session_destroy(); header("location:home.php?msg=logout"); ?> 

First Check is your previous page has session_start(); because if your previous page has not this session_start(); on top your script it will loads.

now after destroying check actually session are destroyed or not.(obvious it must be destroyed.)

you can also use unset($_SESSION['var_name']); to destroy one session variable.

<?php
session_start(); 
session_destroy();
echo "<pre>";
print_r($_SESSION);
exit;
header("location:home.php?msg=logout");
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM