Home > Article > Backend Development > PHP records the last and current visit time code example_PHP tutorial
header(Content-Type: text/html; charset=utf-8);
if(!isset($_COOKIE["php_cookie"])){
setcookie("php_cookie",date("Y-m-d H:i:s")); {
setcookie("php_cookie",date("Y-m-d H:i:s"),time() 60);
echo "The last time you visited the website was: ".$_COOKIE["php_cookie" ];
echo
;
}
echo "The time you visited the website this time is: ".date("Y-m-d H:i:s");
?>
Source: Programming Home