How to set the cookie validity period in php to close the browser process: first use the setCookie method to set hours to an empty string; then set hours to empty in the same way in php; and finally set hours to 0.
#php method to set the cookie validity period to close the browser process:
Use the setCookie method and set hours to empty String, the cookie's lifetime will end after the browser session
function setCookie(name,value,hours,path){}
I also want to set it in PHP like this
setCookie("lastime",$selectlogin['lastime'],0,'/');
Set hours to be empty, but an error was reported, and then I set hours to 0. This cookie is valid for as long as the browser process.
Related learning recommendations: PHP programming from entry to proficiency
The above is the detailed content of How to set the cookie validity period in php to close the browser process?. For more information, please follow other related articles on the PHP Chinese website!