apache 如何通过apache清除PHP $_SESSION?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1605763/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 18:18:31  来源:igfitidea点击:

How to clear PHP $_SESSION by apache?

phpapachesession

提问by Mask

I restarted apache,but the session doesn't expire!

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

回答by mauris

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

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

回答by Stefan Ernst

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

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

回答by Andy

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.

在您的 php.ini 文件中,我相信默认情况下您会这样做,然后会话数据将存储在文件中。因此,弹跳服务器不会破坏它们。

回答by Elitmiar

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

我在开发时通常会做的事情是创建一个页面来取消设置和销毁所有会话。所以每次我需要破坏会话时,我都会运行脚本。例如。www.example.com/destroySession.php

destroySession.php contains something like (only an example)

destroySession.php 包含类似的东西(只是一个例子)

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