开发者

what is stored in cookies [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 12 years ago.

Improve this question 开发者_C百科

I like to know What the content is stored in in cookies? Who will fix that content


A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With PHP, you can both create and retrieve cookie values.

Link - cookies

Explanation from the php.net:

PHP transparently supports HTTP cookies. Cookies are a mechanism for storing data in the remote browser and thus tracking or identifying return users. Cookies are part of the HTTP header, so setcookie() must be called before any output is sent to the browser.


The content of a cookie is nothing more that a small piece of text. The meaning of the text can be anything. It depends on the software the website is using what it means.

Often it is used to store a unique identifier for a user so that a statefull connection can be established between the browser and webserver.

In other cases cookies are used to store authentication information (username and a crypto hash) to that users are automatically logged in when they reconnect to a site (like stackoverflow does).


Cookie contents are arbitrary, each application developer can choose to put any information they wish in a cookie. Cookies will usually be quite small and often contain little more than a session id: a key to larger session state held my a server. The browser needs to know nothing about the contents, it just needs to send the cookie back on the next request.


A cookie is nothing but a small text file that's stored in your browser. contains some data:

-A name-value pair containing the actual data

-An expiry date after which it is no longer valid

-The domain and path of the server it should be sent to

Click here for more details


A cookie is a little piece of text send by a http server to a client. The client may ignore or store the cookie. If stored, the client should store information about the server (host, secure, cookie livetime, ...) as well. When sending a new request to the same server, the cookie may also send by the client to the server.

Typical contents are login information, language settings or session id to provide a statefull communication. Normally only the server creates/changes the cookie value, the client may ignore the cookie or delete it if dated out. The content is encrypted sometimes so the client cannot change it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜