How to delete the same cookie in php from two different path

自古美人都是妖i 提交于 2020-01-01 19:08:29

问题


My problem is that I want to delete the cookie from the page which is in the different directory from the page who sets the cookie but due to the path restriction PHP is not deleting the cookie. Has anyone any solution?


回答1:


When you set and delete the cookies, pass the same path:

setcookie('cookie_name', "SOME_VALUE", time()+3600, '/');   //to set

setcookie('cookie_name', "", -1, '/');            //to unset

http://php.net/manual/en/function.setcookie.php

http://www.phpbuddy.com/article.php?id=12



来源:https://stackoverflow.com/questions/12506702/how-to-delete-the-same-cookie-in-php-from-two-different-path

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