What are the cookies in PHP?

Source: Internet
Author: User
http://www.php.cn/wiki/422.html "target=" _blank ">cookie is a way to maintain the information on the client's browser through the server or scripting language under the HTTP protocol. The use of cookies is common, and many websites that provide personalization services use cookies to differentiate between different users to display content corresponding to the user. For example, the Web interface of the free e-mail site, you need to use cookies. The efficient use of cookies can easily accomplish many complex tasks.

Understanding Cookies

Let's start with a simple introduction to what cookies are and what cookies can do. Let friends have a more clear understanding of cookies and sensory concepts.

1. What is a cookie?

A Cookie is a mechanism for storing data on the client's browser and tracking and identifying users. Simply put, a Cookie is a text file that the Web server temporarily stores on the user's hard disk and is then read by the Web browser. When a user accesses the Web site again, the website records the specific information (such as the location of the last visit, the time spent, the user name and password, and so on) by reading the Cookie file, so that it can be quickly made accordingly. If you do not need to enter the user's ID and password on the page, you can login directly to the website and so on.

The command format for the Cookie text file is as follows:

User name @ website address [Digital].txt

For example, if the user's system disk is a C drive and the operating system is Windows, when the Web site is accessed using a browser, the Web server automatically generates the response Cookie text file in the above command format and stores it in the location specified by the user's hard drive.

It is important to note that under the cookie folder, each cookie file is a simple and generic text file, not a program.

Most of the content in the Cookie file is encrypted, so the surface appears to be just a combination of letters and numbers, and only the server's CGI handlers know what their true meaning is.

2. Where does a generic cookie exist?

The essence of a cookie is a small piece of data, a small piece of data stored on your computer's hard drive. But where does it exist? There may be some differences in how the paths are stored in different browsers.

The path to the cookie file for the Chrome browser is:

C:\Users\ your user name \appdata\local\google\chrome\user data\default\cookies

The cookie file path for the Firefox browser is:

C:\Users\ your username \appdata\roaming\mozilla\firefox\profiles\xxx.default\cookies.sqlite Everyone may be slightly different

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