清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
$start_time = ''; $end_time = ''; switch ($type) { case 'thisWeek'://本周 $start_time = date("Y-m-d H:i:s",strtotime("-0 week Monday")); $end_time = date("Y-m-d H:i:s",strtotime("-0 week Sunday")); break; case 'lastWeek'://上周 $start_time = date("Y-m-d H:i:s",strtotime("-1 week Monday")); $end_time = date("Y-m-d H:i:s",strtotime("-1 week Sunday")); break; case 'thisMonth'://本月 $start_time = date("Y-m-d H:i:s",strtotime("first day of this month")); $end_time = date('Y-m-d H:i:s',strtotime("last day of this month")); break; case 'lastMonth'://上个月 $start_time = date("Y-m-d H:i:s",strtotime("first day of last month")); $end_time = date('Y-m-d H:i:s',strtotime("last day of last month")); break; case 'lastMonth2'://上上个月 $start_time = date("Y-m-d H:i:s",strtotime("first day of last month -1 month")); $end_time = date('Y-m-d H:i:s',strtotime("last day of last month -1 month")); break; case 'lastMonth3'://上上上个月 $start_time = date("Y-m-d H:i:s",strtotime("first day of last month -2 month")); $end_time = date('Y-m-d H:i:s',strtotime("last day of last month -2 month")); break; default : $start_time = date("Y-m-d H:i:s"); $end_time = date("Y-m-d H:i:s"); }