php利用cookie实现访问次数统计代码
[/code]
<?php
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 "<br>";
}
echo "你第".$_COOKIE['visitcount']."访问网站的时间为:".date("y-m-d H:i:s");
?>
[/code]
<?php
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 "<br>";
}
echo "你第".$_COOKIE['visitcount']."访问网站的时间为:".date("y-m-d H:i:s");
?>
[/code]
相关推荐
houmenghu 2020-11-17
kentrl 2020-11-10
逍遥友 2020-10-26
jincheng 2020-09-01
Blueberry 2020-08-15
xclxcl 2020-08-03
zmzmmf 2020-08-03
阳光之吻 2020-08-03
PkJY 2020-07-08
hzyuhz 2020-07-04
89407707 2020-06-27
服务器端攻城师 2020-06-26
阳光岛主 2020-06-25
笨重的蜗牛 2020-06-20
xuanwenchao 2020-06-14
Lophole 2020-06-13
明瞳 2020-06-12
songerxing 2020-06-11