PHP制作日历,实现在1970年到2020年之间的任何一个月份的输出。上半部分
程序员文章站
2022-06-22 19:41:48
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>月历表</title>
<?php
$MONTH = array("元月","一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月");
$enMONTH = array("元月","January" ,"February" ,"Marcy" ,"April" ,"May" ,"June" ,"July" ,"August" ,"September" ,"October" ,"November" ,"December");
$WEEK = array("Sun","Mon","Tues","Wed","Thur","Fri","Sat",);
$BACKCOLOR = array("#FFC" , "#FFF" , "#9F6" , "#FFC" , "#6F0" , "#6F6" , "#F90" , "#F06" , "#F00" , "#FC3" , "#FF6" , "#F99");
function PrintMon($year, $mon)
{
date_default_timezone_set("Asia/Shanghai");
global $MONTH;
global $enMONTH;
global $WEEK;
global $BACKCOLOR;
$startdate =strtotime("1 $enMONTH[$mon] $year"); //获取查询的年月
$enddate = strtotime("+1 month",$startdate); //获取下一个月的开始日期作为月历输出的截止时间
$theDate = getdate($startdate); //把日期转化为字符串格式
$color = $WRITECOLOR[$mon]; //设置月历的背景颜
本文地址:https://blog.csdn.net/weixin_43334002/article/details/107387079
上一篇: 关于CMS的选择几点建议
下一篇: 自增和自减/自增和自减的练习