public function arrangeTime($type){
switch ($type) {
case 'month':
$y = date("Y",time());
$m = date("m",time());
$d = date("d",time());
$t0 = date('t'); // 本月一共有几天
$d0 = mktime(0,0,0,$m,1,$y); // 创建本月开始时间
$d1 = mktime(23,59,59,$m,$t0,$y); // 创建本月结束时间
break;
case 'week':
$w = date( "w",time()); //这天是星期几
$d0 = mktime (0,0,0,date( "m"), date( "d") - $w,date( "Y")); //创建周开始时间
$d1 = mktime (23,59,59,date( "m"), date( "d") - $w + 6,date( "Y"));//创建周结束时间
break;
case 'day':
$d0 = mktime (0,0,0, date( "m"), date( "d"), date( "Y")); //创建日开始时间
$d1 = mktime (23,59,59, date( "m"), date( "d"), date( "Y"));//创建日结束时间
break;
case 'year':
$d0 = strtotime(date("Y",time())."-1"."-1"); //本年开始
$d1 = strtotime(date("Y",time())."-12"."-31"); //本年结束
break;
}
return array($d0, $d1);
}