[PHP] 纯文本查看 复制代码
$sql="select time from user where status=2";
$requ=mysqli_query($con,$sql);
$date=array(
array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
);
while($rs=mysqli_fetch_array($requ)){
$t=$rs['time'];
if($t!=0){
$w=date('w',$t);
$h=date("G",$t);
$date[$w][$h]++;
}
}
$d='[';
for($i=0;$i<7;$i++){
for($j=0;$j<24;$j++){
$dd="[$i,$j,".$date[$i][$j]."]";
$d.="$dd,";
}
}
$d=rtrim($d,',');
$d.=']';