标题:
北京天津汽车尾号限行PHP源代码
[打印本页]
作者:
Nothing
时间:
2016-10-12 13:56
标题:
北京天津汽车尾号限行PHP源代码
/
/
今日限行
function GetXianXing
(
$
day
=
''
)
{
$day
=
$
day
=
=
""
?
date
(
"Y-m-d"
)
:
$
day
;
$iday
=
strtotime
(
$
day
)
;
$n
=
date
(
"w"
,
$
iday
)
;
$sts
=
strtotime
(
"20150901"
)
;
$ets
=
strtotime
(
"20150903"
)
;
if
(
$
iday
>
=
$
sts
&
&
$
iday
<
=
$
ets
)
{
if
(
date
(
"d"
,
$
iday
)
%
2
=
=
0
)
{
return
"单号"
;
}
else
{
return
"双号"
;
}
}
if
(
$
n
=
=
0
|
|
$
n
=
=
6
)
return
"不限"
;
$n
-
-
;
$arrXian
=
array
(
'1,6'
,
'2,7'
,
'3,8'
,
'4,9'
,
'5,0'
)
;
$sdate
=
explode
(
'-'
,
'2014-01-01'
)
;
$edate
=
explode
(
'-'
,
$
day
)
;
$mo
=
(
$
edate
[
0
]
-
$
sdate
[
0
]
)
*
12
+
$
edate
[
1
]
-
$
sdate
[
1
]
;
if
(
in_array
(
date
(
"n"
,
$
iday
)
,
array
(
1
,
4
,
7
,
10
)
)
)
{
$ww
=
0
;
for
(
$
i
=
1
;
$
i
<
=
date
(
"j"
,
$
iday
)
;
$
i
+
+
)
{
if
(
date
(
"w"
,
strtotime
(
date
(
"Y-m-$i"
,
$
iday
)
)
)
=
=
0
)
$
ww
+
+
;
}
/
/
echo
"mo=$mo ww="
.
$
ww
.
"\n"
;
if
(
$
ww
<
2
)
$
mo
-
-
;
}
/
/
echo
"n="
.
$
n
.
"\n"
;
$n
=
(
$
n
+
floor
(
$
mo
/
3
)
*
4
)
%
5
;
/
/
echo $n
.
"\n"
;
return $arrXian
[
$
n
]
;
}
作者:
Nothing
时间:
2016-10-12 13:59
没有设置节假日,可设置单又号起启时间,
使用方法
echo GetXianXing("2016-10-12");
欢迎光临 编程开发论坛 (http://bbs.lihuasoft.net/)
Powered by Discuz! 6.0.0