Ask how to set the path of setcookie without setting the Expiration Time
Source: Internet
Author: User
How can I set the path when setcookie does not set the expiration time? The following write methods do not take effect: setcookie (mycookie, '11', '', '/'); setcookie (mycookie, '11 ',,'/'); setcookie (mycookie, '11', '/'); does setcookie not set the Expiration Time? how to set the path?
The following write methods do not take effect:
Setcookie (mycookie, '11 ','','/');
Setcookie (mycookie, '11 ',,'/');
Setcookie (mycookie, '11 ','/');
But write it like this:
Setcookie (mycookie, '11', time () + 31104000 ,'/');
But I don't want to point to the expiration time. I want to delete the COOKIE as soon as I close the browser.
I did not know how to write this case after reading the online tutorials.
Who can help me? thank you! Share:
------ Solution --------------------
Setcookie ('mycooker', '11', 0 ,'/');
------ Solution --------------------
Is it clear in the manual?
Because the expire parameter is an integer, it cannot be replaced by zero (0 ).
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