Home > Backend Development > PHP Tutorial > php 时间记时代码 个人写法 有好的想法的欢迎贴出来分享

php 时间记时代码 个人写法 有好的想法的欢迎贴出来分享

WBOY
Release: 2016-06-13 12:28:19
Original
844 people have browsed it

php 时间倒计时代码 个人写法 有好的想法的欢迎贴出来分享

            $now=time();

            $secondtime=$end_time-$now;//期限时间减去现在时间 剩余时间

              $second=$secondtime % 60;//取余得到秒数

              $nowtime=floor($secondtime/60);//转化成分钟

              $minute=$nowtime % 60;//取余得到分钟数

              $nowtime=floor($nowtime/60);//转化成小时

              $hour=$nowtime % 24;//取余得到小时数

              $nowtime=floor($nowtime/24);//转化成天数

              $day=floor($nowtime);//得到天数

 

把 $day $hour $minute $second 压入数组 再分配变量即可

1楼天真还是田震
这好像有个错误吧,怎么输出不出来
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template