How to set cookie in php for when browser session end?
You can set Cookie in php using setcookie() method.
Example of Php Cookie
<?php $cookie_name = "user"; $cookie_value = "John Doe"; setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day ?>
This php cookie example is store data for 1day.
Example of Php cookie when browser session end
Set the expire value 0
<?php $cookie_name = "user"; $cookie_value = "John Doe"; setcookie($cookie_name, $cookie_value, 0, "/"); ?>
Thank your for reading.
Learn more about php cookie https://www.php.net/manual/en/function.setcookie.php
How to create pagination in Php?
Get client system information in php
Get mac address of client machine using php
Php network functions
Difference between setinterval and settimeout
How can i print only time in C++?
How can I create a dynamic URL in HTML?
How can we write Koppa in Unicode?
How do you make an SVG animation loop in html?
What is the difference between "npm install package" and "npm install package --save-dev”?