我是php的新手,谢谢你的时间:)
我需要一个功能,它可以通过它自己在php中帮助自己使用corn.for我已经得到了以下代码,这对我很有用,但因为它是一个永无止境的循环,它会导致我的服务器或脚本出现任何问题,如果有的话给我一些建议或替代方案.谢谢.
$interval=60; //minutes
set_time_limit(0);
while (1){
$now=time();
#do the routine job, trigger a php function and what not.
sleep($interval*60-(time()-$now));
}
Run Code Online (Sandbox Code Playgroud)