Prevent cookie deleted when browser close |
Hi,
I've a simple funcion to set a coookie to save GPDR status. PHP Code: set_cookie('myweb_gpdr', 'accepted', 0); This work great but if a close browser and reopen, the cookie not exists. Can you helpme? version: 4.3
You are telling the cookie function to expire after 0 seconds. (3th parameter)
See: https://codeigniter.com/user_guide/helpe...set_cookie (01-12-2023, 11:27 AM)superior Wrote: You are telling the cookie function to expire after 0 seconds. (3th parameter) You are right, I thought "0" was permanent. Changed to YEAR constant and work as spected. PHP Code: set_cookie('myweb_gpdr', 'accepted', YEAR); Regards! (01-12-2023, 11:27 AM)superior Wrote: You are telling the cookie function to expire after 0 seconds. (3th parameter) No. If the cookie expires after 0 seconds, you cannot use the cookie data at all. If set to 0, the cookie will only last as long as the browser is open. |
Welcome Guest, Not a member yet? Register Sign In |