开发者

php - destroy all sessions [duplicate]

This question already has answers here: Is this a proper way to destroy all session data in php? 开发者_高级运维 (9 answers) Closed 2 years ago.

What is the best way to destroy all sessions (not just the one of the current user)?


It depends on how your sessions are being stored. If they're in a database, just delete them. If they're on the file system somewhere like in /tmp, just delete them. For information on sessions in PHP, check out the manual. http://www.php.net/manual/en/book.session.php

Use session_save_path() to find where your session files are being saved by default, unless you're sending them to a memcached,mysql or such. From terminal or PHP issue the system command. For instance

Shell: rm -rf /var/lib/php/session
PHP: shell_exec('rm -rf '.session_save_path() );
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜