当前位置:Gxlcms > PHP教程 > PHP学习笔记之皇历

PHP学习笔记之皇历

时间:2021-07-01 10:21:17 帮助过:5人阅读

PHP学习笔记之万年历
万年历");		$ym = ChangeNum($year) . "年 ". $MONTH[$month];		echo("

$ym

"); echo(""); for ($i=0; $i<7; $i++) //
输出星期几 { echo(""); echo("

$WEEK[$i]

"); echo(""); } echo(""); $theDay = 1; $numOfDays = MonthDays($year, $month);//根据输入的年号和月份,返回该月的天数 $theWeek = WeekDay($year, $month, $theDay); //根据输入的日期,返回对应的星期几 for ($i=0; $i<6; $i++) { echo(""); for ($j=0; $j<7; $j++) { echo(""); if ($theDay <= $numOfDays && $theWeek == $j)//把日期输出到对应的星期几所在列,并注意不要超出本月日期 { echo("

$theDay

"); $theDay++; $theWeek = ($theWeek + 1) % 7;//更新星期 } echo(""); } echo(""); if ($theDay > $numOfDays) //如果已经输出全部日期,结束循环 { $i = 6; } } echo(" 0) { if ($month >= 1 && $month <=12) { PrintMon($year, $month); } else if($month != NULL) { echo("月份不对" . "
"); } } else if($year != NULL) { echo("年份不对" . "
"); } ?>

人气教程排行