万年历 php
<?php header("content-Type: text/html; charset=utf-8");
function calendar($MM='',$YYYY='',$id=''){
if($MM=="") $MM = date("m");
if($YYYY=="") $YYYY = date("Y");
if(checkdate($MM,1,$YYYY)){
$stringDate = strftime("%d %b %Y",mktime (0,0,0,$MM,1,$YYYY));
$days = strftime("%d",mktime (0,0,0,$MM+1,0,$YYYY));
$firstDay = strftime("%w",mktime (0,0,0,$MM,1,$YYYY));
$lastDay = strftime("%w",mktime (0,0,0,$MM,$days,$YYYY));
$printDays = $days;
$preMonth = strftime("%m",mktime (0,0,0,$MM-1,1,$YYYY));
$preYear = strftime("%Y",mktime (0,0,0,$MM-1,1,$YYYY));
$nextMonth = strftime("%m",mktime (0,0,0,$MM+1,1,$YYYY));
$nextYear = strftime("%Y",mktime (0,0,0,$MM+1,1,$YYYY));
$nowmm=$_GET["MM"]?$_GET["MM"]:date("m");
$nowyy=$_GET["YY"]?$_GET["YY"]:date("Y");
$nowday=$_GET["day"]?$_GET["day"]:date("d");
print("<table style=\"border:2px #4C82BE solid;border-radius:8px 8px 8px 8px; padding:5px;\" cellspacing=\"0\" cellpadding=\"0\">");
print("<tr>
<th><a>◀</a></th>");
print("<th>".date("Y年m月",mktime (0,0,0,$MM,1,$YYYY))."</th>");
print("<th><a>▶</a></th>
</tr>");
print("<tr>");
print("<th>日</th>
<th>一</th>
<th>二</th>
<th>三</th>
<th>四</th>
<th>五</th>
<th>六</th>
</tr>");
$currentDays = 1;
for($a=1;$a");
$diffDays = $firstDay-$lastDay;
if($firstDay>$lastDay && $currentDays ==1 && ($diffDays1)){
for($x=$lastDay;$x>=0;$x--){
$printDays = $days-$x;
print("<td> $printDays 1</td>");
}
for($z=1;$z ");
}
for($y=$firstDay;$y$currentDays");
$currentDays++;
}
} elseif($firstDay!=0 && $currentDays==1){
for($z=1;$z ");
}
for($y=$firstDay;$y<a>");
if($nowday==$currentDays){print("<strong>".$currentDays."</strong>");}else{print($currentDays);}
print("</a>");
$currentDays++;
}
} else {
for($u=1;$u<a>");
if($nowday==$currentDays){print("<strong>".$currentDays."</strong>");}else{print($currentDays);}
print("</a>");
$currentDays++;
}
}
print("");
}
print("");
}
}
calendar($_GET['MM'],$_GET['YY']);
?>
以上就是的内容,更多相关内容请关注PHP中文网(www.php.cn)!
使用官方Model Context Protocol PHP SDK将PHP应用程序功能暴露为MCP工具、资源和提示,用于代理工作流。
php免费学习视频:立即使用
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!










