Home > Backend Development > PHP Tutorial > Analysis of methods to clear and destroy session in php_PHP tutorial

Analysis of methods to clear and destroy session in php_PHP tutorial

WBOY
Release: 2016-07-13 10:02:18
Original
754 people have browsed it

Analysis of the method of clearing and destroying session in php

This article mainly introduces the method of clearing and destroying session in php, and analyzes the clearing and destruction of unset() and session_destroy() with examples For session skills, friends who need them can refer to them

This article analyzes the method of clearing and destroying sessions in PHP. Share it with everyone for your reference. The specific analysis is as follows:

The following code deletes a single session value and all sessions respectively

unset() is used to release an existing session value. You can use the session_destroy() function to destroy all sessions.

?

1

2

3

unset($_SESSION['views']);

?>

1 2

3

unset($_SESSION['views']);

1

2

3

4

5

Session_start();

//...

session_destroy();

?>

?>

Destroy all sessions

1 2 3 4 5
Session_start();
<🎜>//...<🎜> <🎜>session_destroy();<🎜> <🎜>?>
I hope this article will be helpful to everyone’s PHP programming design. http://www.bkjia.com/PHPjc/970754.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/970754.htmlTechArticleAnalysis of methods of clearing and destroying sessions in php. This article mainly introduces methods of clearing and destroying sessions in php, and example analysis. To understand the techniques of unset() and session_destroy() to clear and destroy sessions, you need to...
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