$now=time(); //当前时间
$strupdate = "update $tbl_article set hits=hits+1";
if(date("d",$lasthittime)==date("d",$now)){//同一天
$strupdate = $strupdate.",dayhits = dayhits+1";
}else{
$strupdate = $strupdate.",dayhits = 0";
}
if(date("w",$lasthittime)==date("w",$now)){//同一周
$strupdate = $strupdate.",weekhits = weekhits+1";
}else{
$strupdate = $strupdate.",weekhits = 0";
}
if(date("m",$lasthittime)==date("m",$now)){//同一月
$strupdate = $strupdate.",monthhits = monthhits+1";
}else{
$strupdate = $strupdate.",monthhits = 0";
}
$strupdate = $strupdate.",lasthittime='$now' where id='$id'"; //更新点击时间
$fsql->query($strupdate);
不知道好不好用啊,先分析一下再说了
不过感觉好像有些问题,如果是天的应该先判断年月都是一样的,然后再判断天。
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
网安追踪流程
1.不用代理网民发帖流程:发帖人 → ISP → 服务器托管商 → 服务器网警追踪流程:网监 → 服务器IP →...
[阅读全文]
-
-
-
HTTP状态码大全
转自:https://www.cnblogs.com/lxinxuan/archive/2009/10/22/1...
[阅读全文]
-
-
-
-
-
网友评论