This example describes the session setting method after PHP disables cookies. Share to everyone for your reference, specific as follows:
We all know that when in session sessions there is a method based on cookies and two kinds of delivery sessionid based on URLs. In order to implement a client-side ban on the sending of cookies does not affect the client landing site, you can set up php.ini in Session.use_trans_sid=1, indicating that when the client browser prohibits cookies, The link on the page will pass SessionID based on the URL. But a lot of people just set this one option does not achieve the effect, I also encountered this problem, and later a study found
There are two more options in the php.ini file
Session.use_cookies=1
Session.use_only_cookies=1
You'll find the meaning of the English language.
Session.use_cookies indicates whether to start session sessions based on cookies
Session.use_only_cookies Indicates whether session mode is open only based on cookies
So if you want to use a cookie based on the cookie in the browser when you open the cookie, you can do the following by using the URL in the way that you do not open cookies (the most common way to recommend)
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 cookies, use the URL method to do the following settings (this example is mainly to explain 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.
More about PHP Interested readers can view the site topics: "PHP Design Security Course", "PHP object-oriented Program Design Introductory Course", "PHP Mathematical Calculation Skills Summary", "PHP Array" Operation Techniques Encyclopedia, "PHP string (String) Usage summary, "PHP Data structure and algorithm tutorial", "PHP Programming algorithm Summary" and "PHP common database Operation skill Summary"
I hope this article will help you with the PHP program design.