Deleting Cookies In Other Subdomains

隐身守侯 提交于 2020-01-05 07:23:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!