1、composer安装"time-helper"
composer require zjkal/time-helper
2、进行调用
<?php
declare (strict_types=1);
namespace app\index\controller;
use zjkal\ChinaHoliday;
class Index
{
public function index()
{
// 判断指定日期是否为国内的节假日,返回true或false
$a = ChinaHoliday::isHoliday('2023-5-1');
// 判断指定日期是否为工作日,返回true或false
$b = ChinaHoliday::isWorkday('2023-5-4');
dump($a,$b);exit();
}
}