Monday, December 12, 2011

What is the difference between session and cookie?

I want to know the detail difference between PHP session and cookie. Please can anyone help me?|||A session is a store of data on the server containing state information on a user. A particular sessions is identified by its session id, ideally a large (i.e. unguessable) random number. For example, the session could hold a user's shopping cart.





A cookie is also a store. To create a cookie, the server sends a HTTP header to the client (i.e. the web browser). If the client supports and accepts the cookie, the cookie will be sent back to the server along with every request made to the server.





Cookies are often used to store a session id, binding the session to the user.

No comments:

Post a Comment