The logic of Session_Start ()

Source: Internet
Author: User
Tags session id

session_start -start new or resume existing session

Session_Start ();

Print_r ($_session);


See if there is a session object, look at the request head has phpsessid the key = = value of the cookie is not, there is the ID, see if you can find the corresponding ID of the session object

Typically, the server has accepted to PHPSESSID, then the session exists


The request header does not have a cookie that phpsessid the key = value, stating that the server does not have a Session object, creates a session object (and writes the key = = value pair in the Set-cookei of the response header, Notify the browser to save the session ID locally, the next time in the same session to enter the page will not create a new Session object,



Can not manually delete the session object in the browser saved PHPSESSID (assuming can be manually deleted, it would like to create a very large number of server $_session Hyper-Global array, the server certainly does not allow, you want to session_start () Before deleting PHPSESSID, the same session, the next time you enter will create a new session object,

Setcookie (Phpsessid, "", Time ()-100);
Session_Start ();

No, PHPSESSID. Only the server can delete itself, so that the ability to ensure the uniqueness of the $_session variable in a process


The logic of Session_Start ()

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.