简体   繁体   English

如何在特定时间间隔内像PHP中的setTimeout()函数那样在PHP中隐式执行函数?

[英]How to keep on execute a function implicitly in PHP at certain time interval like setTimeout() function in JavaScript?

I've following JavaScript code : 我正在遵循JavaScript代码:

setTimeout('$.ajaxCall("notification.update", "", "GET");', 1000);

Now I want to execute the following function statement at a fix time interval of 1000 like above javascript code. 现在,我想像上面的javascript代码一样,以固定的时间间隔1000执行以下函数语句。

$notifications = Phpfox::massCallback('getGlobalNotifications');

The statement Phpfox::massCallback('getGlobalNotifications'); 语句Phpfox::massCallback('getGlobalNotifications'); should get call at fix time interval of 1000 and the returned result should be updated in $notifications table. 应该以固定的时间间隔1000调用,返回的结果应在$notifications表中更新。

If you have any doubt regarding the issue I'm facing please do let me know. 如果您对我所面临的问题有任何疑问,请告诉我。

Thanks in advance. 提前致谢。

How should I do this in an reliable, efficient and optimum way in PHP? 如何在PHP中以可靠,高效和最佳的方式进行此操作?

There is Linux operating system running on a server. 服务器上运行Linux操作系统。

function settitle() 
{
    $("#notifyno").load('notifytitle.php'); // your page link goes here

    setTimeout("settitle()", 60000);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM