This an example taht illustate how cookie work, but I'm still a little bit confused
- in the picture , there are two cookies, how come first cookie without an expiry date while second one does have? Are name and name2 saved in the same cookie or different cookie?
2.If there are more than one users, how can the server use $_COOKIE['Username'] to know which value to retrivate? For example, there are Tom and Lisa make request to the site,
$name = "Username";
$value = "Tom";
setcookie($name, $value, $expiryTime);
and then
$name = "Username";
$value = "Lisa";
setcookie($name, $value, $expiryTime);
then what's the value of $_COOKIE['Username'] ? Is something related to sessions?
Aucun commentaire:
Enregistrer un commentaire