Home  >  Article  >  Backend Development  >  关于sleep函数的问题

关于sleep函数的问题

WBOY
WBOYOriginal
2016-06-23 13:12:471243browse

我在使用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来实现

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn