Home > Backend Development > PHP Tutorial > PHP写了sleep以后无法执行

PHP写了sleep以后无法执行

WBOY
Release: 2016-06-13 12:20:48
Original
1648 people have browsed it

PHP写了sleep之后无法执行

本帖最后由 qq_27264201 于 2015-04-10 12:15:35 编辑 PHP写了sleep之后,网页运行显示一直在加载,无法显示结果

以下是源码

ignore_user_abort(true);
set_time_limit(0);
$k=0;
$interval=5;
do{
echo $k;
$k++;
sleep($interval);//注释掉这句话就可以运行
}
while(true)
?>
------解决思路----------------------
不设超时限制的死循环?
------解决思路----------------------
无论是否有 sleep($interval);
你的程序都不可能正常,因为是死循环
sleep 只是将两次输出 0 的间隔加长而已
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template