Home > php教程 > php手册 > php利用cookie实现访问次数统计代码_php入门_脚本之家

php利用cookie实现访问次数统计代码_php入门_脚本之家

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:37:07
Original
1294 people have browsed it

php 利用cookie实现访问次数统计,需要的朋友可以参考下。

[/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]
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template