forked from zhusaidong/HolidayApi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
116 lines (116 loc) · 2.46 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
$url = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER["REQUEST_URI"];
substr($url,-1,1) != '/' and $url = dirname($url).'/';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>
节假日api
</title>
<meta name="author" content="zsdroid">
<style>
html, body
{
height: 100%;
}
body
{
margin: 0;
padding: 0;
width: 100%;
display: table;
font-weight: 100;
font-family: 'Lato';
}
.container
{
margin: 0 auto;
text-align: center;
display: table-cell;
vertical-align: middle;
}
.content
{
text-align: center;
display: inline-block;
}
.title
{
font-size: 25px;
}
a
{
text-decoration: none;
}
</style>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js">
</script>
</head>
<body>
<div class="container" style="margin-top: 50px;">
<h3>
节假日api(
<a target="_blank" href="https://github.com/zhusaidong/HolidayApi">
fork on github
</a>)
</h3>
<h5>
判断某个时间是否是节假日
</h5>
<div style="margin:0 auto;width: 500px;text-align: left;">
<fieldset>
<legend>
注:
</legend>
<pre>
1.节假日当天前后几天能放假的都算节假日
如:10.1国庆节,但是放假7天,所以10.1-10.7都算节假日
2.有些节日不放假,算工作日
如:2.2世界湿地日,但是不放假,所以算工作日
3.api中所指的双休日即周六周日,工作日即周一至周五,节假日即法定节假日.
</pre>
</fieldset>
</div>
<br />
<div>
接口地址:
<?php echo $url;?>api.php?date=
<font color="red">
日期
</font>
<br /><br />
demo1:
<a target="_blank" href="<?php echo $url;?>api.php?date=<?php echo date('Y-m-d');?>">
<?php echo $url;?>api.php?date=<?php echo date('Y-m-d');?>
</a>
<br />
demo2:
选择日期:<input type="date" class="HolidayApi-DEMO" />
<br />
<span class="HolidayApi-DEMO-info">
</span>
</div>
</div>
</body>
<script>
$('.HolidayApi-DEMO').change(function()
{
console.log($(this).val());
$.ajax(
{
url:'api.php',
data:
{
date:$(this).val()
},
success:function(data)
{
data = eval(data);
var text = '你选的日期是:' + data[0].date + ',' + data[0].info + '(' + data[0].describe.Name + ')';
$('.HolidayApi-DEMO-info').text(text);
}
});
});
</script>
</html>