从当前一周的数字得到前几周的数据,但我想在最后一行打印当前周日期?怎么样? 在图像当前周显示在第一个TD,但我想在最后TD。如何?
function getStartAndEndDate($week, $year)
{
$time = strtotime("1 January $year", time());
$day = date('w', $time);
$time += ((7*$week)+1-$day)*24*3600;
$return[0] = date('Y-n-j', $time);
$time += 6*24*3600;
$return[1] = date('Y-m-j', $time);
return $return[1];
}$i = 1;$week='';
while($i<=4){ $week[]=date('W', strtotime("-$i week"));$i++; }
foreach($week as $wnumber){
$weeknumber=date($wnumber);
$yearnumber=date("Y");
$sunday = getStartAndEndDate($weeknumber,$yearnumber);
}
<th><?php echo $monday.'To'.$sunday; ?> </th>