Loading...
PHP

Steps to Create Persisten COOKIE

Find out date and time when COOKIE is downloading in client system. Add lifetime to current date and time to get expiry time.

To create Cookie client system with resultant expiry time
<? php
set cookie(“x”,”Webnoid”);
set cookie(“y”, “Schools”, time()+3600)
echo $_COOKIE[x’];
echo $_COOKIE[‘y’];
?>
<a herf=”page2.php”>Go</a>

Every browser contains own memory locations Ram and hard disc, COOKIE information will store in that memory location. We cannot access cookies of one browser to another browser. The memory location of browser will destroy when user closed all windows of that browser

We can destroy persistent COOKIE before life time by recreating that COOKIE with completed time
<?php
set cookie(“abc”, ” “, time()-1);
echo $_COOKIE[‘abc’];
?>

Leave a Reply

Your email address will not be published. Required fields are marked *