Problems deleting cookies, won't unset

后端 未结 18 698
死守一世寂寞
死守一世寂寞 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:34

    Just like is said in the correct answer (I want it to send an updated one), to unset, every parameter used to set the cookie is necessary, even secure and httponly

    Set

    setcookie("name_cookie", $name_value, 0, '/', $domain, false, true);
    

    Unset

    setcookie("name_cookie", '', time()-1000, '/', $domain, false, true);
    

提交回复
热议问题