编写函数取得上个月的最后一天

<?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));
}
原文地址:https://www.cnblogs.com/hanmengya/p/11711496.html