12345678910111213141516171819202122232425 |
- <?php
- namespace app\index\model;
- * 获取请选择月份列表
- */
- class MonthPicker
- {
- public $init_month = "2020-01";
- public $cur_month;
- public $monarr = [];
- public function __construct()
- {
- $time1 = strtotime($this->init_month);
- $time2 = time();
- $this->monarr[] = date('Y-m', $time1);
- while (($time1 = strtotime('+1 month', $time1)) <= $time2) {
- $this->monarr[] = date('Y-m', $time1);
- }
- $this->cur_month = date('Y-m', strtotime('-1 month', $time2));
- }
- }
|