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=';
精彩评论