$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');