Chapter 5Sessions and Cookies
As we've discussed, databases are ideal for storing permanently storing data that an application can retrieve at a later date. There are, however, some options for storing data on a more temporary basis with PHP. Cookies and sessions are designed to hold smaller chunks of data than would normally be held in a database. They're often used to hold users' personal data for login functionality, for example, and to provide quick access to user data for functionality like application profiles.
The big difference between cookies and sessions is where the data is stored. Cookies store data on the client's computer, while sessions store their data on the web server. PHP can work with both cookies and sessions, and we'll take ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access