<table width="500" border="2" align=center>
<caption><h1>倒计时</h1></caption>
<form action="test3.php" method="post">
<tr>
<td><input type="submit" name="sub" value="距离元旦还有?天"></td>
</tr>
<tr>
<td>
<?php
error_reporting(@notice);
date_default_timezone_set("PRC");
//输出当前时间:
echo "当前时间为:".date("Y年m月d日H时i分s秒")."<br>";
//获取当前时间的时间戳:
$time_now=time();
//获取2018年元旦的时间戳
$time_biao=strtotime("1 January 2018");
//计算距离元旦还有多少天,使用ceil()函数进一法取整
$time=ceil(($time_biao-$time_now)/60/60/24);
if($_POST['sub']){
echo "距离元旦还有:";
echo "<b style='color:red'>".$time."</b>天";
}
?>
</td>
</tr>
</form>
</table>
原文链接:https://blog.csdn.net/living_ren/article/details/75048802
本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。
还没有人抢沙发呢~