How to set the cookie validity period in php to close the browser process?

coldplay.xixi
Release: 2023-03-03 09:00:02
Original
2303 people have browsed it

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.

How to set the cookie validity period in php to close the browser process?

#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){}
Copy after login

I also want to set it in PHP like this

setCookie("lastime",$selectlogin['lastime'],0,'/');
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template