热搜:NVER node 开发 php

关于sleep函数的问题

2024-07-22 21:40:01
关于sleep函数的问题

我在使用sleep函数的时候发现,  现在访问页面访问不了  一直显示等待localhost响应


set_time_limit(0); // 执行时间为无限制,php默认执行时间是30秒,可以让程序无限制的执行下去	$interval=120; 	do{		$sql="select CPUTotal,UpdateTime from systemcpu where SystemID=$KeyID";		$result=mysql_query($sql);		$rows=mysql_fetch_array($result);		$GetTime= (strtotime($rows["UpdateTime"])-8*60*60)*1000;		sleep($interval);		}while(true);	


回复讨论(解决方案)

do {
   ........
while(true);

这是死循环,当然要一直等待下去

好的   已经知道了   
我试试使用ajax来实现