This article mainly introduces the variable Sessions in PHP, the interested friend's reference, hope to be helpful to everybody.
Before you store user information in a PHP session, you must first start the session.
notes: The session_start () function must precede the
<?php session_start ();?>
Storing and retrieving session variables
The correct way to store and retrieve session variables is to use the PHP$_session variable:
<?phpsession_start ();//store session data$_session[' views ']=1;? >
Destroy session
If you want to delete some session data, you can use the unset () or Session_destroy () function.
The unset () function is used to release the specified session variable:
<?phpsession_start (); if (Isset ($_session[' views ")) unset ($_session[' views ']);? >
The session is completely destroyed by calling the Session_destroy () function:
<?phpsession_destroy ();? >
notes: Session_destroy () resets the session and you will lose all stored session data.
e-mail to prevent injection