mysql实现按天统计最近7天的数据示例,希望能够帮到大家! $time = time(); $today = strtotime(date('Y-m-d', time()));//零点时间戳 $todayDate = date('Y-m-d', time()); //最近7天 $sevenDaysAgo = strtotime(date('Y-m-d', time())) - 7 * 86400; $sql = "SELECT t1.day, COUNT(t2.id) user_numFROM (SEL