What does session_start do when phpsession and Cookie are enabled?

Source: Internet
Author: User
What does session_start do when phpsession and Cookie are enabled? Will a Session be automatically created on the server, and then a Cookie is created on the client?
Instruct Session_start to perform specific operations on the client and server after enabling Session_start.


Reply to discussion (solution)

Create a file on the server to store the session (if there is no session for the current access)
Create a cookie in the browser, PHPSESSID = session_id ()

The session is created and destroyed by statement commands. the client automatically generates a cookie that records the session id.

After a session is created, you can use $ _ SESSION (array variable, global). you can assign values to cross-page data. of course, for other pages, you can read the data, other pages must declare session_start before using $ _ SESSION.

The session id in the cookie does not need to be ignored, and you do not need to perform operations such as matching or judgment. however, to retain the data on the client, you need to use the relevant cookie statement to assign values/read values. For more information, see the manual.

There are not many Doon function statements, but they should be explained in a long article.
It is better for you to write a few more small programs for testing and understand the program test results.

Session_start () enable session
Sessions can store users' private information, which is invisible to others.
Whether to create sessionid in cookie depends on the relevant settings

As long as you know that the session is the same as the cookie, it is used to save the user's private information, but the former is saved on the server, and the latter is saved in the browser.

Session_start () enable session
Sessions can store users' private information, which is invisible to others.
Whether to create sessionid in cookie depends on the relevant settings

As long as you know that the session is the same as the cookie, it is used to save the user's private information, but the former is saved on the server, and the latter is saved in the browser.
You can get a reply from the moderator everywhere!
The moderator has helped many people!

Cookie. the server sends the data in the cookie to the client.
Session. the server stores the data on the server and sends an ID to the client.

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.