doumin4553 2013-01-30 16:24
浏览 47
已采纳

倒计时器小时重置历史记录

I'm trying to make countdown timer that resets itself every 60 minutes and wont reset on every refresh.

I think the ideal way to do this is via timezone?

  • 写回答

1条回答 默认 最新

  • doufei2355 2013-01-30 16:30
    关注

    There are multiple ways to perform this, but usually i'd recommend storing the unix-timestamp in a MySQL Database, then fetch and compare the previous/stored unix-timestamp with the current timestamp. The PHP-function time() will get you the current timestamp.

    If the entire project is about making a counter, you can probably achieve the same effect by writing/loading from a text-file. The same goes for sessions.

    Here's a little snippet to give you an idea of how to solve this:

    if (($unixtime + (60 * 60)) > time()) //previous time + 60 * 60 sec (60 min).
    {
    //update counter
    }
    
    //present counter
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 FPGA芯片60进制计数器
  • ¥15 前端js怎么实现word的.doc后缀文件在线预览
  • ¥20 macmin m 4连接iPad
  • ¥15 DBIF_REPO_SQL_ERROR
  • ¥15 根据历年月数据,用Stata预测未来六个月汇率
  • ¥15 DevEco studio开发工具 真机联调找不到手机设备
  • ¥15 请教前后端分离的问题
  • ¥100 冷钱包突然失效,急寻解决方案
  • ¥15 下载honeyd时报错 configure: error: you need to instal a more recent version of libdnet
  • ¥15 距离软磁铁一定距离的磁感应强度大小怎么求
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部