function getNextMonthDays($date){
$firstday = date(‘Y-m-01‘, strtotime($date));
$lastday = strtotime("$firstday +2 month -1 day");
$day_lastday = date(‘d‘, $lastday); //获取下个月份的最后一天
$day_benlastday = date(‘d‘, strtotime("$firstday +1 month -1 day")); //获取本月份的最后一天
//获取当天日期
$Same_day = date(‘d‘, strtotime($date));
//判断当天是否是最后一天 或 下月最后一天 等于 本月的最后一天
if($Same_day == $day_benlastday ||$day_lastday == $Same_day){
$day = $day_lastday;
}else{
$day = $Same_day;
}
$day = date(‘Y‘,$lastday).‘-‘.date(‘m‘,$lastday).‘-‘.$day;
return $day;
}
原文地址:http://blog.51cto.com/9300893/2088604