当前位置:Gxlcms > PHP教程 > 关于sleep函数的问题

关于sleep函数的问题

时间:2021-07-01 10:21:17 帮助过:14人阅读

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


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


回复讨论(解决方案)

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

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

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

人气教程排行