PHP获取指定日期的上个月的日期
function last_month_today($time){
$last_month_time = mktime(date("G", $time), date("i", $time),
date("s", $time), date("n", $time), 0, date("Y", $time));
$last_month_t = date("t", $last_month_time);
if ($last_month_t < date("j", $time)) {
return date("Y-m-t H:i:s", $last_month_time);
}
return date(date("Y-m", $last_month_time) . "-d", $time);
}