Made an instance of PHP
is a perpetual calendar of PHP
Call Date () and use of loop structure
It's a simple interface, but the basic function is this.
Don't say much nonsense on the code
PHP$year=Empty($_get[' Y '])?Date("Y"):$_get[' Y ']; $mon=Empty($_get[' m '])?Date("M"):$_get[' m ']; Echo"$yearYears$mon} Month ; ?> <table width= "@" border= "1" > <tr> <th> Sunday </th> <th> Monday </th> <th> Tuesday </th> <th> Wednesday </th> <th> Thursday </th> <th> Friday </th> <th> Saturday </th> </tr> <?PHP$day=Date("T",Mktime(0,0,0,$mon, 1,$year)); $w=Date("W",Mktime(0,0,0,$mon, 1,$year)); $XQ= 1; while($XQ<=$day) { Echo"<tr>"; for($i= 0;$i<= 6;$i++) { if($XQ>$day|| ($w>$i&&$XQ==1)) { Echo"<td> </td>"; }Else{ Echo"<td>{$XQ}</td> "; $XQ++; } } Echo"<tr>"; } Echo"</table>; $nyear=$year;//next year $pyear=$year;//last year $nmon=$mon+1; $pmon=$mon-1; if($nmon>12) { $nyear=$year+1; $nmon=1; } if($pmon<1) { $pyear=$year-1; $pmon=12; } Echo"<a href= ' date.php?y={$pyear}&m={$pmon} ' > Last month </a> '; Echo" "; Echo"<a href= ' date.php?y={$nyear}&m={$nmon} ' > Next month </a> '; ?> </center></body>Above the.
Empty (xx1)? xx2:xx3;
is a ternary operator
Presumably, it means
If the xx1 is a value then execute xx2, if xx1 is empty then execute xx3;
And the use of empty.
Introduction to Date ()
The following is a link to the English version of the PHP manual more see the Harvest
Link: Https://pan.baidu.com/s/1bPTK11wr79fDD3KcKm9q_Q Password: xfidI've got PHP back today.