Problems deleting cookies, won't unset

后端 未结 18 714
死守一世寂寞
死守一世寂寞 2020-12-09 15:33

I\'ve tried searching the php manual and internet on how to delete cookies and I\'ve tried it the exact same way they all say:

setcookie(\"name\", \'\', 1);
         


        
18条回答
  •  旧巷少年郎
    2020-12-09 16:27

    Sometimes you saved the cookie in a different path than you're trying to delete/uset it in.

    Go into eg. Chrome cookie settings and check the cookie path, then add the path to the setcookie command, and delete it like this:

    setcookie( "my_cookie_name","",1,'/mypath');
    

    Trying to delete or unset a cookie that is saved in the wrong path will not work and can be very frustrating.

提交回复
热议问题