1. Initialization (must be used before using session, just use one for each page)
Copy code The code is as follows:
session_start();
2. Save
Copy code The code is as follows:
$_SESSION[$sessionName]=$value;
(value can be double, bool, int, array, object type data)
Example:
Copy code The code is as follows:
$_SESSION['LoginUser']="zs";
3. Take out the specified
Example:
Copy code The code is as follows:
$uName=$_SESSION['LoginUser'];
4. Delete specified
Example:
Copy code The code is as follows:
unset($_SESSION['LoginUser']);
5. Delete all sessions (delete the session file corresponding to the current browser)
Copy code The code is as follows:
session_destroy();
6. Get session_id
Copy code The code is as follows:
$session_id=session_id();
$ session_id=SID; //Constant
http://www.bkjia.com/PHPjc/746867.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/746867.htmlTechArticle1. Initialization (must be used before using session, just use one for each page) Copy the code as follows: session_start(); 2. Save the copied code as follows: $_SESSION[$session...
Statement: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