PHP session usage. 1. session can save any type of data. Because it is stored on the server (I .e. serialized ). 2. the session running mechanism session_start (); has enabled the session, which is equivalent to 1. the session can store any type of data. Because it is stored on the server (I .e. serialized ).
2. session operation mechanism
Session_start (); // The session has been enabled, which is equivalent to reading the session information.
$ _ SESSION ['favcolor'] = 'green ';
$ _ SESSION ['Animal '] = 'cat ';
$ _ SESSION ['Time'] = time ();
// Works if session cookie was accepted
Echo'
Page 2 ';
Page2.php
Echo $ _ SESSION ['favcolor']; // green
Echo $ _ SESSION ['Animal ']; // cat
Echo date ('Y m d H: I: S', $ _ SESSION ['Time']);
Session_start declares the $ _ SESSION variable, assigns a value to $ _ SESSION, and writes data in $ _ SESSION to the data space and releases the variable.
Deleting $ _ SESSION cannot be unset. you can leave it blank: $ _ SESSION = array ();
Delete the current $ _ SESSION data file session_destory () in the default system path C: windos/Temp. You can find this directory in the browser.
Delete sessionID in the browser using cookie technology
SetCookie ('phpsessid ', time ()-1 );
Three sessions can be completely deleted.
3. the cycle may be inconsistent.
A http://www.bkjia.com/PHPjc/477496.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/477496.htmlTechArticle1. session can save any type of data. Because it is stored on the server (I .e. serialized ). 2. session running mechanism session_start (); // The session has been enabled, which is equivalent...