不说了,对于PHPer来说,写不出来说什么都是白瞎,不喜勿喷~~~~

function get_week(){
$data = [];
$format='Y-m-d';
for ($i=0; $i<7; $i++){
$strtotime = strtotime( '+' .$i.' days');
$data[$i]['date'] = date($format ,$strtotime);
$data[$i]['week'] = "周" . mb_substr( "日一二三四五六",date("w" ,$strtotime),1,"utf-8" );
}
$data[]=['date'=>date($format,strtotime( '+7 days')),'week'=>'随时'];
return $data;
}

OK,效果,

Array
(
[0] => Array
(
[date] => 2019-01-09
[week] => 周三
) [1] => Array
(
[date] => 2019-01-10
[week] => 周四
) [2] => Array
(
[date] => 2019-01-11
[week] => 周五
) [3] => Array
(
[date] => 2019-01-12
[week] => 周六
) [4] => Array
(
[date] => 2019-01-13
[week] => 周日
) [5] => Array
(
[date] => 2019-01-14
[week] => 周一
) [6] => Array
(
[date] => 2019-01-15
[week] => 周二
) [7] => Array
(
[date] => 2019-01-16
[week] => 随时
) )

  

 

05-11 18:39