能否几行代码,清空所有用户session

WBOY
Release: 2016-06-23 13:29:50
Original
1487 people have browsed it

网站现在登录着几百人,执行一个管理后台程序,让所有人logout,下线。

网站登录完全使用session,未用cookie,现在需要一个管理功能随时T所有人下线。


谢谢!


回复讨论(解决方案)

foreach(glob(session_save_path() . '/*.*') as $f) unlink($f);
Copy after login
但对正在响应的用户无效

比较好的做法是将 session 存储于数据库中

把保存session 文件的目录内所有文件删除即可。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template