I want to create a remember me feature on my website using cookie. when the user logout i want to destroy all session and cookies. But the problem is i can't delete existing cookie.
i'am using CodeIgniter 4 framework
i already loaded cookie helper in my BaseController. i tried this code in my logout controller :
delete_cookie('remember_me_token');
but that doesnt work, and also i tried this one :
set_cookie('remember_me_token', '', - 1209600); // set to minus
and the result is the same, i can't delete the cookie
please help :(
I followed up with a different approach using the setCookie function which was chained using the response and simply set the expiry time to -1.
Reference : https://codeigniter4.github.io/userguide/outgoing/response.html?highlight=set%20cookie