简体   繁体   中英

How to clear PHP $_SESSION by apache?

我重新启动了apache,但会话没有过期!

删除php.ini中定义的临时目录中的所有文件。

为什么不使用session_destroy()来销毁客户端的会话?

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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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