开发者

How to Display Cookies?

开发者 https://www.devze.com 2023-03-16 20:34 出处:网络
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 pos

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/*.

0

精彩评论

暂无评论...
验证码 换一张
取 消