? Php $ selectedDaydate (d); $ selectedMonthdate (m); $ selectedYeardate (Y); obtain the number of days in a numeric week on the first day of the month $ firstdaydate (w, mktime (0, 0, 0, $ selectedMonth, 1, $ selectedYear); find the last day of the month $ lastday31; do {$ monthOrigdate (m $ SelectedDay = date ('D ');
$ SelectedMonth = date ('M ');
$ SelectedYear = date ('Y ');
// Obtain the number of days of the week in the numeric format on the first day of the month.
$ Firstday = date ('W', mktime (0, 0, 0, $ selectedMonth, 1, $ selectedYear ));
// Find the last day of the month
$ Lastday = 31;
Do {
$ MonthOrig = date ('M', mktime (0, 0, 0, $ selectedMonth, 1, $ selectedYear ));
$ MonthTest = date ('M', mktime (0, 0, 0, $ selectedMonth, $ lastday, $ selectedYear ));
If ($ monthTest! = $ MonthOrig) {$ lastday-= 1 ;}
} While ($ monthTest! = $ MonthOrig );
// Obtain the English name of the current month
$ MonthName = date ('F', mktime (0, 0, 0, $ selectedMonth, 1, $ selectedYear ));
// Display the calendar header
$ Days = array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday ");
$ DayRow = 0;
Print ("
");Print ("
$ MonthName $ selectedYear
");Print ("
\ N ");For ($ I = 0; $ I <= 6; $ I ++ ){Print ("
$ Days [$ I] | \ N ");}Print ("
\ N ");Print ("
\ N ");// Empty the first day of the current month.While ($ dayRow <$ firstday ){Print ("
| ");$ DayRow + = 1;}$ Day = 0;While ($ day <$ lastday ){// The following judgment statement is used to convert each 7 time positions to the next lineIf ($ dayRow % 7) = 0 ){Print ("
\ N
\ N ");}$ Adjusted_day = $ day + 1;// Display the date of the current day in redIf ($ adjusted_day ==$ selectedDay ){Echo"
$ Adjusted_day | ";}Else {echo"
$ Adjusted_day | ";}$ Day + = 1;$ DayRow + = 1;}Print ("\ n
\ N
");
?>