1, each page must open session_start () to use the session in each page.
2, Session_Start () initialization session, the first access will generate a unique conversation ID saved on the client (is based on cookies saved), the next time the user access, Session_Start () will check for the session ID, If a browser will come with this session ID (sent through the header file, this can be seen in the FF browser) to determine the client.
3, to the cookie session will be in the client to save a conversation ID that is session_id, this can be seen through the print cookie, the session_id key value of Session_name,
session_id () = = $_cookie[session_name ()]
4, if the client has disabled cookies, you must pass the SESSION_ID URL to the session
5, Logout session can not use Unset ($_session), you may use $_session = Array () or $_session = null, the correct way to unregister the session is as follows:
| 1 2 3 4 5 6 7 8 9 10 11 12 13-14 |
Correct cancellation Session method://1 open Session session_start (); 2, empty session information $_session = array (); 3, clear client SessionID if (Isset ($_cookie[session_name ()))) {Setcookie (Session_name (), ', Time ()-3600, '/');//4, Completely destroy session Session_destroy (); |