Processing the information of the previous and next month and the previous and next year
Add one after December to become January and add 1# to the year
##One month before subtracting one is December and the year should be subtracted by one
##The code is as follows:<?php
$prey=$nexty=$year;
$prem=$nextm=$mon;
if($prem<=1){
$prem=12;
$prey--;
}else{
$prem--;
}
if($nextm>=12){
$nextm=1;
$nexty++;
}else{
$nextm++;
}
$prey=$year-1;//上一年
$nexty=$year+1;//下一年
//超链接
echo "<tr><td colspan='7'align='center'>";
echo "<a href='sy1.php?y={$prey}'><<</a> ";
echo "<div>{$year}年</div>";
echo "<a href='sy1.php?y={$nexty}'>>></a> ";
echo " ";
echo "<a href='sy1.php?m={$prem}'><</a> ";
echo "<div>{$mon}月</div> ";
echo "<a href='sy1.php?m={$nextm}'>></a>";
echo "</td></tr>";
Submitted get request click event display effect: