1.求当前月的月初月末
$monthbegin = date("Y-m-01",time());
$monthend = date("Y-m-t", time());
2.求指定年月的月初月末
已知年月,末尾拼接上‘-01’,使其成为y-m-d格式的日期字符串,再使用strtotime转换成时间戳
$date_convey = '2019-07-01'
$monthbegin = date("Y-m-01",strtotime($date_convey));
$monthend = date("Y-m-t", strtotime($date_convey));