问题
I was wondering if it's possible to delete a cookie in PHP, meaning re-setting it's time to a time in the past, for a specific subdomain from another subdomain.
For example:
say I am executing the following code on one.myserver.com, which is meant to delete a cookie on two.myserver.com
setcookie("ACOOKIE", 0, time() - 3600, "/", "two.myserver.com");
Currently doing it this way is not working for me. Is there any way I could get something like this to work?
回答1:
Nope, you can only do that from the other subdomain.
回答2:
You dont even know that they exist because they will only be sent(by the client browser) while accessing the domain where they were originally meant for.
回答3:
Not possible. Cookies can only be set and unset from the same fully qualified domain.
来源:https://stackoverflow.com/questions/6525484/deleting-cookies-in-other-subdomains