获取全年节假日,工作日

 $value) {
	$Cimd[] = $value['date'];
}
if(in_array($id,$Cimd)){
 echo '休息日';
}else{
	echo '工作日';
}
}else{

	$data = date("Y");
	
$stime = strtotime("".$data."-01-01");
$etime = strtotime("".$data."-01-30");
$datearr = [];
while ($stime <= $etime) {
	$datearr[] = date('Ymd',$stime);
	$stime = $stime+86400;
}
$arr = array();
foreach ($datearr as $key => $value) {
	$Days = file_get_contents('http://api.goseek.cn/Tools/holiday?date='.$value.'');
	$icma = json_decode($Days,TRUE);
	if($icma['data']!=0){
		$arr[]['date']=$value;
	}
}
$xmlTag = array('date');
$str = "\n";
foreach ($arr as $key => $v) {
	$str.="\t\n";
	foreach ($xmlTag as $key => $x) {
	$str.="\t\t<".$x.">".$v[$x]."\n";
	}
	$str.="\t\n";
}
$str.="";
$file = './write_str.xml';
file_put_contents($file,$str);
}
}
?>

 

你可能感兴趣的:(获取全年节假日,工作日)