How to Display Cookies?
I have setted some cookies in example.com/place1
. When I iterate over $_COOKIE
... it displays all cookies for my domain. Even those t开发者_StackOverflowhat are setted in example.com/place2
. Is it possible to display cookies that are setted only in example.com/place1/*
?
You'll want to set the path in which the cookie is available when you're sending it to the client. For example, on example.com/place1
, set the cookie like this:
setcookie($name, $value, 0, '/place1/');
That way, the cookie will only be available inside example.com/place1/*
.
精彩评论