[英]How can I make a countdown timer in PHP?
How can I make a countdown timer in PHP which starts at 40 seconds and counts in this format:如何在 PHP 中创建一个倒数计时器,它从 40 秒开始并以这种格式计数:
40.59 - 40.48 - 40.47 - etc etc
40.59 - 40.48 - 40.47 - 等等
I also need a button that resets it.我还需要一个重置它的按钮。
Is this possible in PHP?这在 PHP 中是否可行? Do I need to use JavaScript?
我需要使用 JavaScript 吗?
You will need JavaScript to achieve a timer.您将需要 JavaScript 来实现定时器。
Some useful resources:一些有用的资源:
http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/ http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/
http://www.dynamicdrive.com/forums/showthread.php?t=61593 http://www.dynamicdrive.com/forums/showthread.php?t=61593
http://www.devshed.com/c/a/JavaScript/Using-Timers-in-JavaScript/ http://www.devshed.com/c/a/JavaScript/Using-Timers-in-JavaScript/
You would do this entirely on the client side using Java* script *, there are many examples if you google for javascript countdown , ex http://keith-wood.name/countdown.html .您可以使用 Java*脚本* 在客户端完全执行此操作,如果您在 Google 上搜索javascript 倒计时,例如http://keith-wood.name/countdown.ZFC35FDC70D5FC69D269883A822C7A ,则有很多示例。
PHP is executed server side; PHP 在服务器端执行; You'll need to use JavaScript or some other client-side language (flash, silverlight, java applet, etc) if you want it displayed to a user in real-time.
如果您希望在小程序中实时显示给用户,则需要使用 JavaScript 或其他一些客户端语言(flash、silverlight、java 等)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.