PHP AdvancedLesson 36Free preview
PHP Cookies
This lesson is part of PHP · All levels
Summary
A cookie is a small piece of data stored in a visitor's browser and sent back to the server at each request. This lesson discusses how to make cookies with setcookie(), read them through $_COOKIE, and set their running time. Cookies are useful for preferences, but not for sensitive data.
Key points
- Cookies are stored in the visitor's browser, not on the server
- Setcookie() must be called before sending any output
- The cookie value is read through superglobal $_COOKIE
- Each cookie should be given a clear expiration date.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.