PHP万年历


alert('请输入数字')";
// $year = date('Y');
// $month = date('m');
//}
//判断下一月
if($month==12){
//12
$next_month=1;
$next_year=$year+1;
}else{
//1-11
$next_month=$month+1;
$next_year=$year;
}

//判断上一月
if($month==1){
//1
$last_month=12;
$last_year=$year-1;
}else{
//2-12
$last_month=$month-1;
$last_year=$year;
}

//获取当月一共多少天
$days=date('t');

//获取本月一号对应的是星期几 ,也就是说前面要有几个空td
$weeks=date('w',mktime(0,0,0,$month,1,$year));

//获取当前月份的第几天
$day1=date('d');

//获取上个月的总天数
//$last_month = $month - 1;
$stamp=mktime(0,0,0,$last_month,1,$year);
$last_days=date('t',$stamp);

//判断空几格
if($weeks>0){
$l=$weeks-1;
}else{
$l=6;
}

$temp=$l;
?>





"id="year">
"id="month">




年月刷新

一
二
三
四
五
六
七













">



">

















&year=">上一月
                        
&year=">下一月





你可能感兴趣的:(PHP万年历)