<?php function get_last_month_last_day($date=''){ if ($date!='') { $time = strtotime($date); }else{ $time = time(); } $day = date('j',$time); //获取该日期是当前月的第几天 return date('Y-m-d',strtotime("-{$day} days",$time)); }