Cookie Cookie Why does it have to be refreshed before it takes effect

Source: Internet
Author: User

When a customer accesses a Web site based on a PHP technology, a cookie can be generated in PHP using the Setcookie function, which is processed to send the cookie to the client and saved in C:\Documents and Settings\ username \ The Cookies directory. A cookie is part of the HTTP header, so the Setcookie function must be called before any content is sent to the browser. This restriction is the same as the header () function (see the head () function for your own reference). When the customer visits the website again, the browser automatically sends the cookie corresponding to the site in the C:\Documents and Settings\ user name \cookies directory to the server, and the server will automatically convert the cookie from the client to a PHP variable. In PHP5, the cookie sent by the client is converted to a global variable. You can read it by $_cookie[' xxx '. My understanding is that the first visit to the site Setcookies is set up to generate a cookie file, the second visit can be brought with the file together to send, will have value, you can not let others generate with the file fly! At least not for now. So it takes two steps to view cookies.
Setcookie (string string

Cookie Cookie Why does it have to be refreshed before it takes effect

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.