赛亿提成统计系统

MonthPicker.php 665B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace app\index\model;
  3. /**
  4. * 获取请选择月份列表
  5. */
  6. class MonthPicker
  7. {
  8. public $init_month = "2020-01";
  9. public $cur_month;
  10. public $monarr = [];
  11. public function __construct()
  12. {
  13. $time1 = strtotime($this->init_month); // 自动为00:00:00 时分秒 两个时间之间的年和月份
  14. $time2 = time(); // 当前时间
  15. $this->monarr[] = date('Y-m', $time1); // 当前月;
  16. while (($time1 = strtotime('+1 month', $time1)) <= $time2) {
  17. $this->monarr[] = date('Y-m', $time1); // 取得递增月;
  18. }
  19. $this->cur_month = date('Y-m', strtotime('-1 month', $time2));
  20. }
  21. }