php 日历
来源:互联网 发布:linux网站管理系统限速 编辑:程序博客网 时间:2024/05/21 17:27
//$year=2009;
//$month=2;
//$day=15;
$month=$_GET['month'];
$year=$_GET['year'];
$day=$_GET['day'];
if($month=='')
$month=date('m');
if($day=='')
$day=date('d');
if($year=='')
$year=date('Y');
function prt_calendar($month,$day,$year){
$nextMonth=$month+1;
$nextYear=changeYear($year,$nextMonth);
$preMonth=$month-1;
$preYear=changeYear($year,$preMonth);
$firstDay=date("w",mktime(0,0,0,$month,1,$year));
$countMonth=date("t",mktime(0,0,0,$month,1,$year));
echo "<table border='1' alagin='center' bgcolor='bisque' width='50%'><tr><td colspan='7'"
." align='center'><a href='calendar.phtml?year=$preYear&month=$preMonth'>"
."上月</a> $year-$month-$day "
."<a href='calendar.phtml?year=$nextYear&month=$nextMonth'>下月</a></td></tr>";
echo "<tr align='center'><td><font color='red'>日</td><td>一</td><td>二</td><td>三</td>"
."<td>四</td><td>五</td><td>六</td></tr>";
echo "<tr align='center'>";
if($firstDay)
echo "<td colspan='$firstDay'> </td>";
for($i=$firstDay+1;$i<($countMonth+$firstDay+1);$i++){
$bgcolor=day_color($month,$day,$year,($i-$firstDay));
$color=font_color($month,($i-$firstDay),$year);
echo "<td '$bgcolor'><font color='$color'>".($i-$firstDay)."</font></td>";
if($i%7==0)
echo "</tr><tr align='center'>";
}
$col=8-$i%7;
if($col!=7)
echo "<td colspan='$col'> </td></tr>";
else
echo "</tr></table>";
}
function font_color($month,$day,$year){
$sunday=date("w",mktime(0,0,0,$month,$day,$year));
if($sunday=="0"||$sunday=="6"){
return "red";
}else{
return "grey";
}
}
function day_color($month,$day,$year,$today){
$show_today=date("d",mktime(0,0,0,$month,$day,$year));
$sys_today=date("d",mktime(0,0,0,$month,$today,$year));
if($show_today==$sys_today){
return "bgcolor='darkgray'";
}else{
return "";
}
}
function changeYear($year,&$month){
if($month<=0){
$month=12;
return $year-1;
}
if($month>12){
$month=1;
return $year+1;
}
return $year;
}
- php日历
- php 日历
- php 日历
- PHP 日历
- php代码日历
- php日历程序
- 一个PHP日历程序
- PHP日历 Calendar
- [原创]PHP打印日历
- php日历类
- 一个PHP日历程序
- PHP 简单日历
- PHP生成的日历
- php精简日历
- php 实现日历
- PHP版本日历
- php日历Calendar
- php制作日历
- 判断目录、创建目录、保存文件、取得目录下文件、删除文件
- 梦的终焉II
- Adding a device from a kernel module the udev way (pi, a device that prints out the value of pi)
- GoDaddy上注册域名,还需要备案吗?
- 再看ODBC数据访问
- php 日历
- 穷人们的生活
- Windows多媒体API
- Hibernate 疑难异常及处理
- plug.xml文件初步分析
- java web service 开发 具体实例
- CComPtr用法(转)
- 转:[WPF] WPF资源收集 分享
- ASP.NET - 如何:验证 ASP.NET 服务器控件的必需项