Ec (2); & lt ;! DOCTYPEhtmlPUBLIC & quot;-W3CDTDXHTML1.0TransitionalEN & quot; www. w3.orgTRxhtml1DTDxhtml1-transitional. dtd & quot; & gt; & lt; htmlxmlns & quot; www. w3.org19 script ec (2); script
Php calendar code
Day
I
II
3.
Thu
V.
Sat.
@ Date_default_timezone_set ('+ 8 ');
Function week2day ($ str ){
$ Days = array ('mon', 'tue ', 'wed', 'thu', 'fri', 'sat', 'sun ');
Return array_search ($ str, $ days) + 1;
}
$ SelectTimestamp = time ();
$ CurMonth = date ('n', $ selectTimestamp );
$ CurYear = date ('y', $ selectTimestamp );
$ CurDay = week2day (date ('D', $ selectTimestamp ));
$ TodayNum = date ('J', $ selectTimestamp );
$ CurMonthTotal = date ('T', $ selectTimestamp );
$ FirstDay = week2day (date ('D', mktime (0, 0, $ curMonth, 1, $ curYear )));
$ LastDay = week2day (date ('D', mktime (0, 0, 0, $ curMonth, $ curMonthTotal, $ curYear )));
For ($ I = 0; $ I <$ firstDay; $ I ++ ){
Echo ('
');
}
For ($ I = 1; $ I <= $ curMonthTotal; $ I ++ ){
If ($ I ==$ todayNum ){
Echo ('
X
');
} Else {
Echo ('
'. $ I .'
');
}
}
?>