I tried to use setcookie("user", "", time()-3600)
to delete a cookie from php, but it's not working for me, when I check in the tool of the broswer, the cookie seems to still exist. Does anyone know why?
note: this is the domain cookies.. mean I set this cookies with this way setcookie('user','true',time() + 2592000,"/",".user.com",0);
Try setcookie ('user', "", time() - 3600, "/", ".user.com", 1);
Just a warning- IE and opera sometimes maintain cookie values until after restart- that may be part of the issue.
setcookie("user", 0, time()-3600)
根据PHP文档 ,您的代码应该可以正常运行,但是,您可以尝试以下操作:
setcookie("user", "", time() - 3600, "/", ".user.com", 0);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.