开发者

How to expire page in PHP when user logout

开发者 https://www.devze.com 2022-12-30 01:54 出处:网络
I want to expire my previous page when end user 开发者_Python百科clicks on LogOut or Back button of the browser.If you include this at the top of all of your pages, it will require the client to alway

I want to expire my previous page when end user 开发者_Python百科clicks on LogOut or Back button of the browser.


If you include this at the top of all of your pages, it will require the client to always reload the content, making the back-button requesting a new copy of the page.

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

http://php.net/manual/en/function.header.php


You could have some issues with the browser back button, because when clicked, some browsers simply don't reload the page from the server and displays the previous state of the page from the cache.


Destroy the session key with session_destroy();

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号