一、效果图
二、示例
<?php //获取日期 $now_year = date('Y'); $now_month = date('m'); $date1 = $date2 = array(); for ($i = 1; $i <= $now_month; $i++) { if ($i < 10) { $i = '0' . $i; } $date1[] = $now_year . "-" . $i; } for ($i = (count($date1) + 1); $i <= 12 ; $i++) { if ($i < 10) { $i = '0' . $i; } $date2[] = ($now_year - 1) . "-" . $i; } $date = array_merge($date2, $date1); var_dump($date);
标签:12,示例,日期,当月,计算,PHP From: https://www.cnblogs.com/yang-2018/p/17039420.html