switch ($date_type){ case 'yesterday': $res_data = [ 'start_time' => strtotime(date('Y-m-d',time())) - 24 * 3600, 'end_time' => strtotime(date('Y-m-d',time())) ]; break; case 'today': $res_data = [ 'start_time' => strtotime(date('Y-m-d',time())), 'end_time' => time() ]; break; case 'all_days': // 所有时间范围内!!! $res_data = [ 'start_time' => strtotime('2019-01-01'), 'end_time' => time() ]; break; case 'this_mouth': $res_data = [ 'start_time' => strtotime(date('Y-m-01',time())), 'end_time' => time() ]; break; case 'this_year': $res_data = [ 'start_time' => strtotime(date('Y-01-01',time())), 'end_time' => time() ]; break; default : $res_data = [ 'start_time' => 0, 'end_time' => 0 ]; break; }