开发者

PHP cookie expire

Okay, when logging in I simply set a cookie to true and开发者_开发问答 set it to expire in a fortnight. but if the user wants to logout, how do I edit that cookie to say false or just make it go away by expiring it?


Use setcookie() again. You can either set it's value to false or make it expire in the past. Both should have the desired effect.


From PHP:

setcookie('yourCookie', '');

You can also do it in JavaScript

document.cookie='yourCookie=';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜