Cookie application in PHP

Source: Internet
Author: User
Use setcookie (& quot; name & quot;, & quot; jinbiao & quot;, time () & #43; 3600) for cookies in PHP) 1. when you access the page for setting cookies, the following data is returned to the client: Set-Cookienamejinbiao; expiresMon, 10-Sep-201209: 47: 09GMT. when the browser obtains this information, PHP uses cookies.

Setcookie ("name", "jinbiao", time () + 3600)

1. when you access the page for setting cookies, the following data will be returned to the client:
Set-Cookie name = jinbiao; expires = Mon, 10-Sep-2012 09:47:09 GMT
After the browser obtains the information, it will keep the cookie value in a specified folder on the client.
2. if the third parameter is not specified, the client will not save the cookie. when the browser is closed, the cookie disappears.
3. cookie can only keep strings

Cookie lifecycle:
If the Expiration time is set for the cookie, such as setcookie ("name", "jinbiao", time () + 3600), the lifecycle is the set expiration time (one hour)
If the expiration time is not set for the cookie, when the execution is similar to setcookie ("name", "jinbiao"), as long as the page is not all closed, the cookie value exists, the cookie expires until all pages are closed.

The same cookie can be obtained on pages of the same site.

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

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