Changes

Jump to: navigation, search

PHP and Cookies - Creating, Reading and Writing

800 bytes added, 14:51, 6 June 2007
The Difference Between Cookies and PHP Sessions
== The Difference Between Cookies and PHP Sessions ==
Both cookies and PHP sessions allow you to store data that is accessible across different pages of your web site, but there are differences between the two approaches.
Cookies are stored on the hard drive of the visitor to your site and are, therefore, visible to other domains you may host and run. Thay also have a long life and can be configured to persist long after the user has left your site. Cookies are limited in size and quantity (4kb each and a maximum of 20 cookies per domain).
 
PHP sessions, on the other hand, are stored on the web server. This means they are not visible to other web servers you may have hosting your domain. They are also not limited in size and can be used for storing secure data, since they are not transmitted to the client browser in the way that cookies are.
== The Structure of a Cookie ==

Navigation menu