当使用 strtotime WEEK 在第 00 周获得 1970 年的年份时?我正在使用一个大功能,所以不能在这里发布所有内容。
我查看周,得到工作日。
for ($weekNumber=00;$weekNumber<=$weekEnd;$weekNumber++)
{
runTheScript($weekNumber,$month,$weekStart,$weekEnd,$link,$limit,$standardTarget,0,$year);
}
我的结果 -
周,开始,结束,天
49 1st Dec 2015 6th Dec 2015 6
50 7th 12月 2015 13th Dec 2015 7
51 14th Dec 2015 20th Dec 2015 7
52 21st Dec 2015 27th Dec 2015 7
53 2015年12月28日 2015年12月31日 4
下一个
00 1st 1月 1970 3rd 1月 2016 3
01 4th 1月 2016 10th 1月 2016 7
02 11th 1月 2016 17th 1月 2016 7
03 18th 1月 2016 24th 1月 2016 7
04 25th 1月 2016 31st 1月 2016 7
我如何设置周数
$weekStart = date('W',strtotime($year . '-' . $month. '-01'));#$_REQUEST['start'];
$weekEnd = date('W',strtotime($year . '-' . $month. '-'.date('t',strtotime($year . '-' . $month. '-01'))));#$_REQUEST['end'];
#if ($weekStart > $weekEnd) $weekStart = 1;
这是因为没有第 00 周。 去年的第53周是12月28日(星期一)。 下周是1月4日(星期一)第01周。 您应该将循环更改为从 weekNumber=01 开始,并将"大于或等于"更改为"大于"
for ($weekNumber=1;$weekNumber<$weekEnd;$weekNumber++)