| 1234567891011121314151617181920212223242526272829 |
- <?php
- declare (strict_types = 1);
- // 这是自定义的公共文件
- use think\Log;
- //获取某月天数
- function getDaysOfMonth($days)
- {
- $date = new \DateTime("{$days}-01");
- $days = $date->format('t');
- return $days;
- }
- //获取某年多少天
- function getDaysOfYear($year)
- {
- $year = intval($year);
- if ($year % 400 == 0 || ($year % 4 == 0 && $year % 100 != 0)) {
- return 366;
- }
- return 365;
- }
|