生成月初月末便于拼接sql时间:2023-03-09 20:46:55 for ($i=1; $i < 13; $i++) { $date = strtotime(date("2015-$i-01")); $firstday = date("Y-m-01",$date); $lastday = date("Y-m-t",$date); echo $firstday.'==='.$lastday.'<br/>'; }