PHP中cookie和Session

时间:2021-03-28 16:28:03

Cookie与Session

cookie 列子

if(!isset($_COOKIE['cookie']))
{
setcookie("cookie",date('Y-m-d H:i:s'));
echo "欢迎访问";
}else{
setcookie("cookie",date('y-m-d H:i:s',time()+60));
echo "上次访问时间为:".$_COOKIE['cookie'];
}

echo "</br>";
echo "本次时间为:".date('Y-m-d H:i:s',time());