Using a Cookie
Learn how to use cookies.
We'll cover the following
Array of key-value pairs
The PHP server has a built-in mechanism that takes the Cookie
header from the request, processes its contents, and produces a nice array of key/value pairs.
The array is a superglobal variable, just like $_GET
and $_POST
.
This one is called $_COOKIE
.
Let’s use the name
cookie in random.php
to personalize the page a bit:
Get hands-on with 1200+ tech skills courses.