一个无聊的PHP判断
<div align="center" style="height:100px; position: absolute;left: 50%;top: 50%;width:200px;height:100px;margin-left:-100px;margin-top:-50px;"><?php
echo "<p align='center'>今天是".date("Y年m月d")."。</p>";
$Date_1 = date("Y-m-d");
$Date_2 = "2017-01-01";
$d1 = strtotime($Date_1);
$d2 = strtotime($Date_2);
$Days = round(($d2-$d1)/3600/24);
echo "<p>距离2017年还有".$Days."天。</p>";
$d3=date("M");
if($d3<"3" or $d3>"11"){
echo "<p>冬天了,多穿点衣服吧!</p>";
}elseif($d3<"6" and $d3<"2"){
echo "<p>春天了,小树发芽了。</p>";
}elseif($d3<"5" and $d3<"9"){
echo"<p>蝉在叫,人坏掉。</p>";
}else{
echo "<p>秋天了,叶子都黄了。</p>";
}
?>
</div>实际效果嘛~
话说,我记得好像单行判断,可以省略{}花括号的
页:
[1]