$year = date("Y"); $month = date("m"); $day = date("d"); $start = mktime(0,0,0,$month,$day,$year);//当天开始时间戳 $end= mktime(23,59,59,$month,$day,$year);//当天结束时间戳 $map['user_id'] =$user_id; $map['type'] ='1'; $map['date'] =array('between',array($start,$end)); $daymoney = M('Log')->where($map)->sum('money');