Home > Backend Development > PHP Problem > What is the method to destroy session in php

What is the method to destroy session in php

青灯夜游
Release: 2023-03-11 15:20:02
Original
3987 people have browsed it

In PHP, you can use the session_destroy() function to destroy the session, the syntax format is "session_destroy()"; this function can destroy all the data in a session, that is, completely destroy the Session.

What is the method to destroy session in php

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

If the entire Session ends, you can use session_destroy( ) function destroys all data of the current session, that is, completely destroys the Session. The syntax format of the function is as follows:

session_destroy()
Copy after login

session_destroy() function does not need to pass in any parameters. In addition, although the session_destroy() function can destroy the current session All data, but the $_SESSION array will not be reset, nor will the Cookie be reset. If the Session needs to be used again, the session_start() function must be called again.

Note: Using $_SESSION = array() to clear the $_SESSION array will also clear the contents of the Session file corresponding to this user on the server side. When using the session_destroy() function, the session file corresponding to this user on the server side is deleted.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What is the method to destroy session 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template