Problems deleting cookies, won't unset

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

    If you delete cookie for the specific path and your path parameter ends with the trailing slash '/' then it will work in Firefox and IE, but won't work in Chrome and Opera. If there is no trailing slash then it will only work in Chrome and Opera.

    So you should use both:

    setcookie('cookiename', '', time() - 60*60*24, $chatPath); // WebKit
    setcookie('cookiename', '', time() - 60*60*24, $chatPath . '/'); // Gecko, IE
    

提交回复
热议问题