我想让 PHP 输出一些文本,然后休眠一秒半,然后再输出一些文本.
I want PHP to output some text, then sleep for a second and a half, and then output some more text.
<?php
echo 'Output one.';
usleep(1500000);
echo 'Output two.';
?>
我的问题是所有文本都被同时输出 - 等了 1.5 秒之后.我读过一些关于一个叫做flush的函数——但它似乎不起作用.也许我没有使用它写.任何帮助将不胜感激^^
My problem is that all text is being put out simultaneously - after having waited those 1.5 seconds. I have read something about a function called flush - but it doesn't seem to work. Maybe I'm not using it write. Any help would be appreciated ^^
提前致谢!
看看这个
<?php
ob_start();
echo 'Output one.';
ob_flush();
usleep(1500000);
echo 'Output two.';
ob_flush();
?>
这篇关于睡前PHP输出文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!