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 answers

why 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

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -