復制代碼 代碼如下:
 
$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"; //更新點擊時間 
$fsql->query($StrUpdate); 
新聞熱點
疑難解答