JayVee Posted September 19, 2008 Share Posted September 19, 2008 How do I make a cookie expire at the end of a session? When i try setcookie('cookiename', 'yes', time() + 0); or setcookie('cookiename', 'yes', 0); the cookie expires instantly. Link to comment https://forums.phpfreaks.com/topic/124939-cookie-expire-at-end-of-session/ Share on other sites More sharing options...
discomatt Posted September 19, 2008 Share Posted September 19, 2008 Try setcookie('cookiename', 'yes'); Though setcookie('cookiename', 'yes', 0); should work... and works for me. Link to comment https://forums.phpfreaks.com/topic/124939-cookie-expire-at-end-of-session/#findComment-645553 Share on other sites More sharing options...
.josh Posted September 19, 2008 Share Posted September 19, 2008 if you want a cookie to expire at the end of a session, just use session vars, cuz that's the diff between session vars and cookies. Link to comment https://forums.phpfreaks.com/topic/124939-cookie-expire-at-end-of-session/#findComment-645554 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.