//判断日期是不是节假日或者双休日接口 @param time [时间(时间戳或者Y-m-d都可)]
public function get_type_by_date(){
$t = $_GET['time'];
if($this->isDateTime($t)){
$date = date("Ymd",strtotime($t));
}else{
$date = date("Ymd",$t);
}
$url = "http://api.goseek.cn/Tools/holiday?date=".$date;
$res = json_decode(file_get_contents($url),true); //数组格式
return $res;
}
//判断是否是date格式
public function isDateTime($dateTime){
$ret = strtotime($dateTime);
return $ret !== FALSE && $ret != -1;
}

接口地址说明:

1、接口地址:http://api.goseek.cn/Tools/holiday?date=数字日期,支持https协议。 
2、返回数据:工作日对应结果为 0, 休息日对应结果为 1, 节假日对应的结果为 2 
3、节假日数据说明:本接口包含2017年起的中国法定节假日数据,数据来源国务院发布的公告,每年更新1次,确保数据最新

05-11 22:08