PHP输出日历表代码实例_PHP教程
PHP输出日历表代码实例
这篇文章主要介绍了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 |
$MONTH = array("元月","一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"); $enMONTH = array("元月","January" ,"February" ,"Marcy" ,"April" ,"May" ,"June" ,"July" ,"August" ,"September" ,"October" ,"November" ,"December"); $WEEK = array("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); $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 = $BACKCOLOR[$mon]; //设置月历的背景颜色
echo("
} ?>
$year = $_POST['myYear']; $month = $_POST['myMonth']; if (is_numeric($year) && $year >= 1970 && $year { if (is_numeric($month) && $month >= 1 && $month { PrintMon($year, $month); } else if($month != NULL) { echo("月份不对" . " } } else if($year != NULL) { echo("年份不对" . " } ?>
|
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
相关文章
相关视频
专题推荐
-
独孤九贱-php全栈开发教程
全栈 170W+
主讲:Peter-Zhu 轻松幽默、简短易学,非常适合PHP学习入门
-
玉女心经-web前端开发教程
入门 80W+
主讲:灭绝师太 由浅入深、明快简洁,非常适合前端学习入门
-
天龙八部-实战开发教程
实战 120W+
主讲:西门大官人 思路清晰、严谨规范,适合有一定web编程基础学习
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论