1. Session can save any type of data. Because it is stored on the server (that is, it has been serialized).
2. Session operation mechanism
Session_start(); //The session has been opened, 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 -> Operates the $_SESSION variable -> writes the data in $_SESSION to the data space, and releases the variable.
To delete $_SESSION, you cannot unset it, you can make it empty: $_SESSION = array();
Delete the current $_SESSION data file session_destroy(), in the default system path C:windos/Temp. This directory can be found in your browser
Delete the cookie technology used in the browser and delete the sessionID
setCookie('PHPSESSID',time()-1);
Use the three together to completely delete the session
3. Cycles may be inconsistent.