开发者

How to clear PHP $_SESSION by apache?

I restarted apache,but t开发者_高级运维he session doesn't expire!


Delete all files in the temporary directory defined in php.ini.


Why not use session_destroy() to destroy the client's session?


If you have:

session.save_handler = files

in your php.ini file, which I believe you will by default, then session data will be stored in files. Therefore bouncing the server won't destroy them.


What I ussually do when I'm developing, I create a page that unsets and destroys all sessions. So everytime I need to destoy the sessions I run the script. eg. www.example.com/destroySession.php

destroySession.php contains something like (only an example)

session_start();
unset($_SESSION['name']); //If only one session variable is used
session_destroy();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜