时间:2021-07-01 10:21:17 帮助过:5人阅读
输出全部日期,结束循环 { $i = 6; } } echo(" 0) { if ($month >= 1 && $month <=12) { PrintMon($year, $month); } else if($month != NULL) { echo("月份不对" . "万年历 "); $ym = ChangeNum($year) . "年 ". $MONTH[$month]; echo(""); echo(" $ym
"); for ($i=0; $i<7; $i++) //输出星期几 { echo(" "); $theDay = 1; $numOfDays = MonthDays($year, $month);//根据输入的年号和月份,返回该月的天数 $theWeek = WeekDay($year, $month, $theDay); //根据输入的日期,返回对应的星期几 for ($i=0; $i<6; $i++) { echo(""); echo(" "); } echo("$WEEK[$i]
"); echo(""); for ($j=0; $j<7; $j++) { echo(" "); if ($theDay > $numOfDays) //如果已经"); if ($theDay <= $numOfDays && $theWeek == $j)//把日期输出到对应的星期几所在列,并注意不要超出本月日期 { echo(" "); } echo("$theDay
"); $theDay++; $theWeek = ($theWeek + 1) % 7;//更新星期 } echo("