How the session is set after disabling cookies

Source: Internet
Author: User

We all know that when session sessions have a cookie-based and URL-based two method of passing SessionID. In order to enable the client to prohibit the sending of cookies does not affect the customer landing site, you can set php.ini session.use_trans_sid=1, indicating when the client browser prohibits cookies, The links on the page are passed SessionID based on the URL. But a lot of people just set this option and did not achieve the effect, I also encountered this problem, later study found
There are two options in the php.ini file
Session.use_cookies=1
Session.use_only_cookies=1
A careful look at the English above will find its meaning.
Session.use_cookies indicates whether to start a session based on cookies
Session.use_only_cookies indicates whether to only open the session mode based on the cookie

Therefore, if you want to use cookies in a cookie-based manner when the browser opens the cookie, the following settings will be used when the cookie is not turned on (the most common way, recommended)
In the php.ini file
Session.use_trans_sid=1
Session.use_only_cookies=0
Session.use_cookies=1
Or in a PHP program.
Ini_set ("Session.use_trans_sid", "1″");
Ini_set ("Session.use_only_cookies", 0);
Ini_set ("Session.use_cookies", 1);
If the browser does not open the cookie, use the URL to do the following settings (this example mainly to illustrate the difference between setting session.use_only_cookies and Session.use_cookies)
In the php.ini file
Session.use_trans_sid=1
Session.use_only_cookies=0
Session.use_cookies=0
Or in a PHP program.
Ini_set ("Session.use_trans_sid", "1″");
Ini_set ("Session.use_only_cookies", 0);
Ini_set ("Session.use_cookies", 0);

Try it yourself and you'll understand the difference between session.use_only_cookies and session.use_cookies.

How the session is set after disabling cookies

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.