Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP permanent cookie

Tags:

php

cookies

How do I set up a cookie that won't never expire, even when the user closes his browser or stops his machine?

Thanks!

like image 747
DiegoP. Avatar asked Aug 21 '26 19:08

DiegoP.


1 Answers

I don't think there is a way to have a 'permanent' cookie, but rather one that expires very very far into the future. Just because you remained logged into a website/service the next time you return or after you close your browser, does not mean that there is no expiration date on the cookie.

Check out the PHP documentation on setting the lifetime of a cookie.

like image 121
barfoon Avatar answered Aug 23 '26 10:08

barfoon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!