Home > php教程 > php手册 > php实现的日历程序

php实现的日历程序

WBOY
Release: 2016-06-06 20:03:14
Original
1492 people have browsed it

这篇文章主要介绍了php实现的日历程序,可实现基本的日历显示与实时查询功能,非常具有实用价值,需要的朋友可以参考下

本文实例讲述了php实现的日历程序。分享给大家供大家参考。具体如下:

Sun","Mon","Tue","Wed","Thu","Fri","Sat"); $Weekday_count = count($Weekday); $daynum = 0; $space = "

 "; $col = 0; ////打印表格头部//// ?>
 ".$Weekvalue." "; echo ""; ////打印日期列表//// //当月份为4,6,9,11的时候,从数组末尾删除一个值,也就是删除31这个值. if($Month == 4 or $Month == 6 or $Month == 9 or $Month == 11) { array_pop($Maxday); $Maxday_count--; } //先判断月份是否为2月,如果是的话再判断年份是否为闰年,如果是的话就从数组尾部移除2个值,否则就移除3个值. if($Month == 2) { if($Year % 4 == 0) { array_pop($Maxday); array_pop($Maxday); $Maxday_count-=2; } else { array_pop($Maxday); array_pop($Maxday); array_pop($Maxday); $Maxday_count-=3; } } ////打印日期//// while($daynum "; while(list($colnum,$Dayvalue) = each($Maxday)) { //判断当前日期为一星期中的哪一天 $DayWeek = date("w",strtotime($Year."-".$Month."-".$Dayvalue)); //当当前日期处于第1个,也就是每个月的第1天的时候,在它前面补上相应的空格子 if($Dayvalue == 1) for($i=0;$i"; $u2 = ""; } else { $u1 = ""; $u2 = ""; } if($DayWeek == 0 or $DayWeek == 6) $color = "red"; else $color = "black"; echo ""; //用本周第几天这个值加1,如果是7的倍数就换行退出此轮循环(换行打印) if(($DayWeek+1) % 7 == 0) { $col++; break; } } echo ""; } ?>

运行效果如下:

php实现的日历程序

希望本文所述对大家的php程序设计有所帮助。

  >>   ">  ">>>
 ".$u1.$Dayvalue.$u2." 
Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template