//今天4月15号
//获取当前月份天数
$j = date("t");
//获取本月第一天时间戳
$start_time = strtotime(date('Y-m-d'));
$dateWeek = array();
//赋值每天的日期
for($i=0; $i<$j; $i++)
{
$date = date('Y-m-d',$start_time+$i*86400);
$dateWeek[$i]['date'] = $date;
$words = array('日','一','二','三','四','五','六');
$dateWeek[$i]['week'] = '周'.$words[date('w',$start_time+$i*86400)];
}
array(30) {
[0]=>
array(2) {
["date"]=>
string(10) "2020-04-15"
["week"]=>
string(6) "周三"
}
[1]=>
array(2) {
["date"]=>
string(10) "2020-04-16"
["week"]=>
string(6) "周四"
}
[2]=>
array(2) {
["date"]=>
string(10) "2020-04-17"
["week"]=>
string(6) "周五"
}
[3]=>
array(2) {
["date"]=>
string(10) "2020-04-18"
["week"]=>
string(6) "周六"
}
[4]=>
array(2) {
["date"]=>
string(10) "2020-04-19"
["week"]=>
string(6) "周日"
}
[5]=>
array(2) {
["date"]=>
string(10) "2020-04-20"
["week"]=>
string(6) "周一"
}
[6]=>
array(2) {
["date"]=>
string(10) "2020-04-21"
["week"]=>
string(6) "周二"
}
[7]=>
array(2) {
["date"]=>
string(10) "2020-04-22"
["week"]=>
string(6) "周三"
}
[8]=>
array(2) {
["date"]=>
string(10) "2020-04-23"
["week"]=>
string(6) "周四"
}
[9]=>
array(2) {
["date"]=>
string(10) "2020-04-24"
["week"]=>
string(6) "周五"
}
[10]=>
array(2) {
["date"]=>
string(10) "2020-04-25"
["week"]=>
string(6) "周六"
}
... 省略 ...
}