How to write logout in php

coldplay.xixi
Release: 2023-03-05 15:22:02
Original
4095 people have browsed it

How to log out in php: first release all [$_SESSION] variables currently created in the memory, the code is [session_unset]; then delete the session file corresponding to the current user and release the session id.

How to write logout in php

[Related learning recommendations:php graphic tutorial]

How to write a logout in php:

In the PHP program, after the login is completed, it will be stored in the session. When logging out, the session needs to be released. The corresponding code is as follows.

Copy after login

It should be noted that:

  • session_unset();Release all$_SESSION## that have been created in the memory. #Variable, but does not delete the session file and does not release the corresponding session id;

  • session_destroy();Delete the session file corresponding to the current user and release the session id, The contents of the$_SESSIONvariable in the memory are still retained;

Related learning recommendations:

php programming(video)

The above is the detailed content of How to write logout in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!