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,); but the write method is as follows: setcookie (mycookie, 11, time () + 31104 may I ask if setcookie does 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!


------ 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 ).

Related Article

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: 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.