在php中实现倒数计时器 [英] implement the countdown timer in php

查看:86
本文介绍了在php中实现倒数计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何在php中实现倒数计时器

例如:拍卖结束时间:5天5小时4分4秒



谢谢你,请帮助我

how we can implement the countdown timer in php
exemple:Auction end in: 5 days 5 hours 4 minutes 4 sec

thanks u please help me

推荐答案

你可以通过操纵2个整数,然后将它们分开来给你提供天数,小时数,分钟数,秒数。



你只想基于unix时代的两个时间 - 当前和到期。



使用php函数time()来获取自纪元以来的时间。将此号码传递给javascript。使用javascript,获取当前时间以来经过的时间。从另一个减去1,做一些分裂和瞧!你剩下的时间了。



现在,运行func来计算每秒,分钟,等等的剩余时间。

计时器部分,这是论坛如何告诉你几秒钟,几分钟,几小时前发布的东西,或告诉你它是'昨天'等等。



http://stackoverflow.com/questions/1090869/why-是-1-1-1970-the-epoch-time



这是我现有的旧项目的一部分。

You can do it just by manipulating 2 integers, followed by dividing them out to give you the num of days, hours, mins, secs.

You'd just want to base both times - current and expiration, on the unix epoch.

Use the php function time() to get the time since the epoch. Pass this number to the javascript. Using javascript, get the elapsed time since the epoch, at the current time. Subtract 1 from the other, do some dividing and et voila! You've the time remaining.

Now, run the func to calculate the time remaining once every second, minute, whatever.
Without the timer part, this is how the forum is able to tell you that something was posted seconds, minutes, hours ago or tell you it was 'yesterday' etc, etc.

http://stackoverflow.com/questions/1090869/why-is-1-1-1970-the-epoch-time

Here's an exerpt from an old project I have.
function makeNiceTime(


intTime)
{
intTime) {


curTime = time();
curTime = time();


这篇关于在php中实现倒数计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆