note 123567 added to function.setcookie
| From: | Anonymous@php.net | Date: | Wed, 30 Jan 2019 15:49:55 +0000 |
| Subject: | note 123567 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-210144@lists.php.net to get a copy of this message | ||
I haven't seen this mentioned here and had a lot of issues (and created a lot of stupid hacks)
before I figured this out.
If you have a couple of environments for example, and are trying to set cookies on two domains:
example.com (main site)
dev.example.com (dev site)
In this case your (same named) cookies will interfere with each other if you're trying to set
cookies with the domain parameter.
Simply use an empty string for the domain parameter and the cookies will refer to each host
separately.
If you use the subdomain www. on the main site this won't be an issue, but without a subdomain
you'll have issues with reading each others' cookies.
----
Server IP: 208.43.231.9
Probable Submitter: 82.199.157.35 (proxied: 68.3.207.202)
----
Manual Page -- http://php.net/manual/en/function.setcookie.php
Edit -- https://master.php.net/note/edit/123567
Del: integrated -- https://master.php.net/note/delete/123567/integrated
Del: useless -- https://master.php.net/note/delete/123567/useless
Del: bad code -- https://master.php.net/note/delete/123567/bad+code
Del: spam -- https://master.php.net/note/delete/123567/spam
Del: non-english -- https://master.php.net/note/delete/123567/non-english
Del: in docs -- https://master.php.net/note/delete/123567/in+docs
Del: other reasons-- https://master.php.net/note/delete/123567
Reject -- https://master.php.net/note/reject/123567
Search -- https://master.php.net/manage/user-notes.php