如何使用PHP进行倒数计时 [英] How to make a countdown using PHP

查看:89
本文介绍了如何使用PHP进行倒数计时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的兄弟婚礼创建一个网站.到目前为止,一切进展顺利.但是,他想在首页上对婚礼进行倒计时;

Im creating a website for my brothers wedding. And so far all is going well. However, he wants a countdown to the wedding on the homepage;

距婚礼还剩下时间:X个月,X天,X个小时.

Time left until the wedding: X months, X days, X hours.

我更愿意使用php来做到这一点,但是可以接受其他建议.

I would preferebly like to do this using php, but would be open to other suggestions.

如果您可以为我提供编码方面的帮助,或者只是指向相关材料,那将很有用.

if you can help me with ideas for the coding, or just point me to relevant material, that would be useful.

婚礼在7月30日星期六.

The wedding is on Saturday 30th July.

推荐答案

如果您需要计数器仅在页面刷新时显示,并且在页面加载后保持静态,那么PHP就可以了.

If your need your counter to be displayed only on page refresh and be static once the page is loaded, then PHP will be fine.

如果需要在显示页面时刷新倒数计时,则需要使用JavaScript.

If you need the countdown to get refreshed when the page is displayed, you'll need to use JavaScript.

我个人会去寻求已经实施的东西,例如那个小脚本.

Personally I would go for something already implemented, like that small script.

这篇关于如何使用PHP进行倒数计时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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