获得当天时间,并输出本周一到本周天。
$today = date("Y-m-d");
$monday = date('Y-m-d', strtotime('monday this week'));
$tuesday = date('Y-m-d', strtotime('+1 day', strtotime($monday)));
$wednesday = date('Y-m-d', strtotime('+1 day', strtotime($tuesday)));
$thursday = date('Y-m-d', strtotime('+1 day', strtotime($wednesday)));
$friday = date('Y-m-d', strtotime('+1 day', strtotime($thursday)));
$saturday = date('Y-m-d', strtotime('+1 day', strtotime($friday)));
$sunday = date('Y-m-d', strtotime('+1 day', strtotime($saturday)));
IF(date('Y-m-d', strtotime('+1 day', strtotime($saturday)))==date("Y-m-d")){ECHO "一样1111111111111";}
echo "本周周一日期:" . $monday . "\n";
echo "本周周二日期:" . $tuesday . "\n";
echo "本周周三日期:" . $wednesday . "\n";
echo "本周周四日期:" . $thursday . "\n";
echo "本周周五日期:" . $friday . "\n";
echo "本周周六日期:" . $saturday . "\n";
echo "本周周日日期:" . $sunday . "\n";
效果如下
