Summary

In this hour and the previous hour, you learned different ways of saving state in a stateless protocol. All methods use some combination of cookies and query strings, sometimes combined with the use of files or databases. These approaches all have their benefits and problems.

A cookie is not intrinsically reliable and cannot store much information. On the other hand, it can persist over a long period of time.

Approaches that write information to a file or database involve some cost to speed that might become a problem on a popular site. Nonetheless, a simple ID can unlock large amounts of data stored on disk.

A query string is unlikely to persist as a cookie will and looks ugly in the location window. Even so, it can pass relatively ...

Get Sams Teach Yourself PHP in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.