- $yearPath = 'year.' . date('Y') . '.json';
- //查找某年节假日和补班日
- $yearAPI = 'http://timor.tech/api/holiday/year';
-
- if (!file_exists($yearPath)) {
-
- $yearJson = file_get_contents($yearAPI);
-
- file_put_contents($yearPath, $yearJson);
-
- } else {
-
- $yearJson = file_get_contents($yearPath);
-
- }
- $holiday = json_decode($yearJson,true);
- //获取一维数组
- $data = array_column($holiday['holiday'], 'date');
-
//2022因放假调休上班的工作日
$data_day_off_2022 = [
'2022-01-29','2022-01-30','2022-04-02','2022-04-24','2022-05-07','2022-10-08','2022-10-09'
];
//2022法定节假日
$data_day_holiday_2022 = [
'2022-01-01','2022-01-02','2022-01-03','2022-01-31','2022-02-01','2022-02-02','2022-02-03','2022-02-04','2022-02-05','2022-02-06',
'2022-04-03','2022-04-04','2022-04-05','2022-04-30','2022-05-01','2022-05-02','2022-05-03','2022-05-04','2022-06-03','2022-06-04','2022-06-05',
'2022-09-10','2022-09-11','2022-09-12','2022-10-01','2022-10-02','2022-10-03','2022-10-04','2022-10-05','2022-10-06','2022-10-07'
];
composer require maidou/holiday use Maidou\Holiday\Holiday; //使用 $days = Holiday::instance()->work_days_between("2022-10-01","2022-10-31"); |