The following examples are mainly about the PHP tutorial session in the actual application of the operation, if there is a session to create logoff initialization registration instance.
1
*/
session_start (); Initializing session
$_session["Name"]= "Mike"; Create new value
$_session["Sex"]= "male"; Create new value
Print_r ($_session); Output pre-logoff content
echo "<br>";
echo "----------------------------";
echo "<br>";
Session_unset (); Log off all
Print_r ($_session); Output content again for comparison
Session_destroy (); End Session
2
$barney = "A big purple dinosaur"; Defining string variables
Session_register ("Barney"); Registering the session as a new global variable
$_session["Zim"]= "a invader from another planet."; Define Session Value
$http _session_vars["SpongeBob"]= "He's got square pants." The definition session method of the old version
3
Session_Start (); Initializing session
$_session[' name ']= "Yoursession"; Register a Session variable
$result =session_module_name (); Returns the current module name
echo $result. " n "; Output results
Session_destroy (); Logout session
4
Session_Start (); // Initializes the session
$old _sessionid=session_id (); //gets the current session ID
SESSION_REGENERATE_ID () //replaces the current session ID
$new _ with a new value SESSIONID=SESSION_ID (); //gets the new session ID
Echo "old session: $old _sessionid<br/> "; //output old session ID
Echo" new session: $new _sessionid <br/> //output The new session ID
Print_r ($_session); //Output Session content