/**
* 获取一周日期
* @param $time 时间戳
* @param $format 转换格式
*/
function
get_week(
$time
,
$format
=
"Y-m-d"
) {
$week
=
date
(
'w'
,
$time
);
$weekname
=
array
(
'星期一'
,
'星期二'
,
'星期三'
,
'星期四'
,
'星期五'
,
'星期六'
,
'星期日'
);
//星期日排到末位
if
(
empty
(
$week
)){
$week
=7;
}
for
(
$i
=0;
$i
<=6;
$i
++){
$demo
[
$i
][
'date'
] =
date
(
$format
,
strtotime
(
'+'
.
$i
+1-
$week
.
' days'
,
$time
));
$demo[$i
][
'week'
] =
$weekname
[
$i
];
}
return
$demo;
}