<?php $y = "2003"; $m = "5"; $d = strtotime("$y-$m-1"); // 该月开始 $e = strtotime("$y-$m-".date("t",$d)); //该月结束 //验证 echo date("Y-m-d",$d); echo date("Y-m-d",$e); ?>php