且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使PHP函数每5秒循环一次

更新时间:2022-12-28 18:16:10

***不要在PHP中进行此操作,而是通过计算从数据库获得的时间与当前时间之间的差值来尝试在客户端进行操作. 您可以像这样在JS中创建该代码:

It's not preferable to make this in PHP, try to make on client side by calculating difference between time you got from database and current time. you can make this in JS like this:

setInterval(function(){
      // method to be executed;
    },5000);  // run every 5 seconds