国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home php教程 PHP開發(fā) Destruction of session variables in PHP

Destruction of session variables in PHP

Dec 24, 2016 am 09:14 AM

1.What is session?
Equivalent to a client (can be a browser, app, ftp, etc., and if you open several more clients in the same browser, they are considered different clients), during this period the server establishes a unique identifier for this purpose (session_id session_name), in fact, it is an array Array(). The beginning and end of the Session does not start with entering the user name and password in the business, nor does it end with closing the browser and refreshing the web page

2. Destruction of session variables
Program code
session_unset();
session_destroy();
?>

session_unset()
Release all $_SESSION variables currently created in memory, but do not delete the session file and do not release the corresponding The session id

session_destroy()
deletes the session file corresponding to the current user and releases the session id. The content of the $_SESSION variable in the memory is still retained

[Note]:

Delete session method:

1. unset ($_SESSION ['xxx']) deletes a single session, unset($_SESSION['xxx']) is used to unregister a registered session variable. Its function is the same as session_unregister(). session_unregister() is no longer used in PHP5 and can be relegated to obsolescence.

unset($_SESSION) This function must not be used, it will destroy the global variable $_SESSION, and there is no feasible way to restore it. Users can also no longer register the $_session variable.

2. $_SESSION=array() deletes multiple sessions

3. session_destroy() ends the current session and clears all resources in the session. . This function will not unset (release) global variables related to the current session, nor will it delete the client's session cookie. PHP's default session is based on cookies. If you want to delete cookies, you must use the setcookie() function.

Return value: Boolean value.

Function description: This function ends the current session. This function has no parameters, and the return value is true

session_unset() If $_session is used, this function will no longer work. Since PHP5 must use $_session, this function can be relegated to the sidelines.

The steps to delete session can be drawn:

①session_start()

②$_SESSION=array()/unset($_session['xxx'])

③session_destroy()


More sessions in PHP For articles related to the destruction of variables, please pay attention to the PHP Chinese website!

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

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1502
276