接口说明
本接口提供 2025年的中国法定节假日数据,包括:
- 法定节假日(元旦、春节、清明节、劳动节、端午节、中秋节、国庆节)
- 调休补班信息(节前补班、节后补班)
- 工资倍数(正常、双倍、三倍工资)
接口地址: http://www.53kr.com/holiday.php?year=YYYY&week=Y
参数说明:
• year:日期(必填),支持格式:
- YYYY:查询整年(如:2025)
- YYYY-MM:查询某月(如:2025-01)
- YYYY-MM-DD:查询某天(如:2025-01-01)
• week:是否包含周末(可选),Y=包含周末
- 查询整年时:默认不包含周末,需传 week=Y 才显示
- 查询某月或某天时:自动包含周末
调用示例
查询整年(不包含周末):
fetch('http://www.53kr.com/holiday.php?year=2025')
.then(response => response.json())
.then(data => {
console.log('统计:', data.stats);
console.log('节假日:', data.holiday);
});
查询整年(包含周末):
fetch('http://www.53kr.com/holiday.php?year=2025&week=Y')
.then(response => response.json())
.then(data => {
console.log('统计:', data.stats);
console.log('所有日期:', data.holiday);
});
查询某月:
fetch('http://www.53kr.com/holiday.php?year=2025-01')
.then(response => response.json())
.then(data => {
console.log('1月数据:', data.holiday);
});
查询某天:
fetch('http://www.53kr.com/holiday.php?year=2025-01-01')
.then(response => response.json())
.then(data => {
console.log('元旦数据:', data.holiday);
});
jQuery (Ajax):
$.ajax({
url: 'http://www.53kr.com/holiday.php?year=2025',
type: 'GET',
dataType: 'json',
success: function(data) {
console.log(data.holiday);
}
});
PHP (file_get_contents):
$url = 'http://www.53kr.com/holiday.php?year=2025';
$json = file_get_contents($url);
$data = json_decode($json, true);
print_r($data['holiday']);