function DateListShow($time,$current = '',$days = 7){
if(empty($time)){
$time = time();
}
$daytime = 86400;
$n = date('N',$time);
if(!empty($current)){
$time = ($current-$n)*$daytime+$time;
$n = $current;
}
$formart_current = array();
$formart_show = array();
for($i=1;$i<=$days;$i++){
//获取每天的时间戳
$formart_time = $time+($i-$n)*$daytime;
$formart_show[] = array('formart_time'=>$formart_time,'N'=>$n,'weekname'=>getWeekName($i),'date'=>date('Y-m-d 00:00:00',$formart_time));
if($i == $n){
$formart_current = array('formart_time'=>$formart_time,'N'=>$n,'weekname'=>getWeekName($i),'date'=>date('Y-m-d 00:00:00',$formart_time));
}
if ($i==1){
$formart_first = array('formart_time'=>$formart_time,'N'=>$i,'weekname'=>getWeekName($i),'date'=>date('Y-m-d 00:00:00',$formart_time));
}
elseif ($i==$days){
$formart_end = array('formart_time'=>$formart_time,'N'=>$i,'weekname'=>getWeekName($i),'date'=>date('Y-m-d 00:00:00',$formart_time));
}
}
return $data = array('show'=>$formart_show,'current'=>$formart_current,'first'=>$formart_first,'end'=>$formart_end);
}
function getWeekName($param = ''){
$week = array(
'1'=>'星期一',
'2'=>'星期二',
'3'=>'星期三',
'4'=>'星期四',
'5'=>'星期五',
'6'=>'星期六',
'7'=>'星期日'
);
if(!empty($param)){
return $week[$param];
}
return $week;
}