如下面这段脚本:
复制代码 代码如下:
<?php
header("content-type: text/plain");
set_time_limit(0);
$infostring = "hello world" . "n";
while( isset($infostring) )
{
echo $infostring;
flush();
ob_flush();
sleep(5);
}
?>
当我们执行后,每隔5秒钟,我们会得到一行 hello world ,如果不按停止按钮,浏览器会不停的一行一行继续加载。
通过这一方法,我们可以完成很多功能,例如机器人爬虫、即时留言板等程序。
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!