Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
好的,登录时我只需设置一个 cookietrue并将其设置为两周后过期。但是如果用户想注销,我该如何编辑那个cookie来说假或者只是让它过期让它消失?
true
再次使用 setcookie()。您可以将其值设置为 false 或使其在过去过期。两者都应该有预期的效果。
来自 PHP:
setcookie('yourCookie', '');
您也可以在 JavaScript 中执行此操作
document.cookie='yourCookie=';