How the session Works

Source: Internet
Author: User

Client--------->1.request------------------------->server

                       2. Session_Start ();   |<-------------3.reponse (session_id) <--------|   |-------------> 4.request (session_id)--------->|                       5. Session_Start ();   |<-------------6.reponse (session_id) <---------|   |------------- >7. Request (session_id + logout)-->|                      8. Session_destroy ();   |<-------------9. Reponse (Delete cookie file) <-------| 1. The client opens the Web page and makes a request to the server, and the client does not deliver the session_id 2 in the request because there is no corresponding cookie file. After receiving the client request, the server starts the session processing by executing the session_start () function, first confirming that there is no session_id in the request and, if not, issuing a new session_id; The session_id file is called, and the information is written to the $_session and deposited in a file beginning with Sess_.  3. The $_session parameter that writes the message is sent back to Client,client after the information sent by the get server, and the information is stored in a cookie.  4. The client writes the session_id in the cookie to the header and then to Ser again.Ver makes a request. Repeat 1-3 of the operation  7. Client issues a logout request  8. After the server accepts the request, it begins by executing the Session_destroy () function to delete session file processing  9. The server sends a command to the client to delete the cookie file stored on the client:   Setcookie (Session_name (), ", Time ()-60, '/');

How the session works

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.