php - Why can't I set a cookie? -
php - Why can't I set a cookie? -
this question has reply here:
php array cookie info: shows after refresh page? 2 answerswhy won't work? i've tried both localhost , actual server:
<?php setcookie("name", "alex porter", time()+3600); echo $_cookie["name"]; ?>
unlike in the linked question, doesn't show on refresh.
setcookies not impact $_cookie array in current request; informs php add together cookie response header, while $_cookie contains cookies sent client.
setcookie() defines cookie sent along rest of http headers ..
.. [set cookies] can accessed on next page load $_cookie or $http_cookie_vars arrays ..
php cookies
Comments
Post a Comment