zoukankan      html  css  js  c++  java
  • PHP 判断当前日期是否是法定节假日或者休息日 (原)

        //判断日期是不是节假日或者双休日接口 @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次,确保数据最新

  • 相关阅读:
    centos7安装elasticsearch
    nginx安装
    Emit学习笔记
    Docker备忘录
    IdentityServer4-参考
    IdentityServer4-端点
    IdentityServer4-主题
    css
    IdentityServer4-快速入门
    IdentityServer4-介绍
  • 原文地址:https://www.cnblogs.com/gyrgyr/p/11231548.html
Copyright © 2011-2022 走看看