php利用cookie实现访问次数统计代码_php基础
程序员文章站
2022-05-14 11:17:13
...
[/code]
global $count;
$count=1;
if(!isset($_COOKIE["visittime"])){ setcookie("visittime",date("y-m-d H:i:s"));
setcookie("visitcount",1); echo "欢迎你第一次访问网站!";
}
else{
setcookie("visittime",date("y-m-d,H:i:s"),time()+60); $count=$_COOKIE['visitcount']+1;
setcookie("visitcount",$count); echo "你上次访问网站的时间为:".$_COOKIE['visittime'];
echo "
";
}
echo "你第".$_COOKIE['visitcount']."访问网站的时间为:".date("y-m-d H:i:s");
?>
[/code]
global $count;
$count=1;
if(!isset($_COOKIE["visittime"])){ setcookie("visittime",date("y-m-d H:i:s"));
setcookie("visitcount",1); echo "欢迎你第一次访问网站!";
}
else{
setcookie("visittime",date("y-m-d,H:i:s"),time()+60); $count=$_COOKIE['visitcount']+1;
setcookie("visitcount",$count); echo "你上次访问网站的时间为:".$_COOKIE['visittime'];
echo "
";
}
echo "你第".$_COOKIE['visitcount']."访问网站的时间为:".date("y-m-d H:i:s");
?>
[/code]
上一篇: 关于文件复制,文件名乱码的有关问题
下一篇: ps修照片基本步骤