$arr = array("星期天","星期一","星期二","星期三","星期四","星期五","星期六");
$year = $_POST['year'];
$month = $_POST['month'];
$day = $_POST['day'];
if(checkdate($month,$day,$year))
/*
bool checkdate ( int month, int day, int year )
如果给出的日期有效则返回 TRUE,否则返回 FALSE。检查由参数构成的日期的合法性。日期在以下情况下被认为有效:
year 的值是从 1 到 32767
month 的值是从 1 到 12
Day 的值在给定的 month 所应该具有的天数范围之内,闰年已经考虑进去了。
*/
{
$week = $year>0?(5+($year+1)+($year-1)/4-($year-1)/100+($year-1)/400)%7:(5+$year+$year/4-$year/100+$year/400)%7;
$week = $month>2?($week+2*($month+1)+3*($month+1)/5)%7:($week+2*($month+2)+3*($month+2)/5)%7;
if (($year%4==0 && $year%100 !=0 ) || $year%400 ==0 && $month >2 )
{
$week =($week+1)%7;
}
$week=($week+$day)%7;
echo $arr[$week];
}
else
echo “错误”;
?>
比格高
逼格更高