作者:手机用户2502894247 | 来源:互联网 | 2017-05-13 02:18
";
echo"
";
echo"{$year}年{$mon}月
";
echo "";
echo "一 | ";
echo "二 | ";
echo "三 | ";
echo "四 | ";
echo "五 | ";
echo "六 | ";
echo "
";
//4.遍历输出日历
$d=1;
while($d<=$day){
echo"{$d}";
$d++;
}else{
echo"&#160; | ";
}
}
}
//5.处理上下月,上下年的信息
$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 "
";
echo"<<&#160;";
echo "{$year}年&#160;";
echo ">>&#160;&#160;";
echo"&#160;&#160;";
echo"<&#160;";
echo "{$mon}月&#160;";
echo ">";
echo "
";
echo"
";
echo"";
?>
以上就介绍了PHP实现一个日历,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。