Cookie and session & lt ;? Php & nbsp; setcookie (& quot; mm & quot;, & quot; gg & quot;); & nbsp; echo $ _ COOKIE [& quot; mm & quot;];? & Gt; two questions: (1) cookie and session
Setcookie ("mm", "gg ");
Echo $ _ COOKIE ["mm"];
?>
Two questions:
(1)
If no expiration time is set, the cookie will be automatically deleted when the browser is closed. Can the gg output be output after I close the browser under chrome?
(2)
The cookie must be refreshed once before it takes effect. This is because after setcookie, the server sends the cookie to the browser and refresh it again to send the cookie back.
So why does the session not need to be refreshed again? After all, isn't sessionID stored on the client a cookie? Don't you need to refresh the sessionID to facilitate server identification?
------ Solution --------------------
The session exists on the server, not on the client.
Discussion
Setcookie ("mm", "gg ");
Echo $ _ COOKIE ["mm"];
?>
Two questions:
(1)
If no expiration time is set, the cookie will be automatically deleted when the browser is closed. Can the gg output be output after I close the browser under chrome?
(2)
The cookie must be refreshed once before it takes effect. This is because after setcookie, the server sends the cookie to the browser ,......
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