Preamble: The relationship between the client cookie and the service-side session is somewhat blurred, and the session designation cannot be used after the cookie is disabled, and it is verified that the error is not found.
1: Setting values for session in PHP environment php.ini:
Processing session access Mode Session.save_handler = files//session file storage path Session.save_path =/tm P//session using the function of cookies, start: 1 session.use_cookies = 1//session name Session.name = PHPSESSID//Auto start, 0: off; 1: On session.auto_start = 0//session The lifetime of the cookie used, in seconds Session.cookie_lifetime = 0 These default values, you can use the session without modification. 2: But when we have a browser to disable cookies, it will appear what you think, the session can not be used. At this point we should study in the php.ini to find out session.use_trans_sid = 1//This field allows SessionID to be transmitted via the URL session.use_only_cookies = 1; Turn on the use of cookies only to store the session ID at this time again to test the discovery session was acquired. But when session.use_only_cookies = 0; Cannot get to the session, in php.ini this value defaults to 03: code: ① When the browser does not disable cookies: a.php:
b.php
② when the browser disables the cookie and set php.ini Session.use_trans_sid = 1//This field allows SessionID to be transmitted via the URL session.use_only_cookies = 1; Turn on only using cookies to store session ID code: a.php
b.php
The above is my understanding of the cookie and session, if not, can leave a message, study together, progress.