21,886
社区成员
发帖
与我相关
我的任务
分享
header("Content-type: multipart/x-mixed-replace;boundary=endofsection");
print "--endofsection\n";
$pmt = array("-", "\\", "|", "/" );
for( $i = 0; $i <10;$i ++ )
{
sleep(1);
print "Content-type: text/plain\n\n";
print "Part $i ".$pmt[$i % 4];
print "--endofsection\n";
ob_flush(); //强制将缓存区的内容输出
flush(); //强制将缓冲区的内容发送给客户端
}
print "Content-type: text/plain\n\n";
print "The end\n";
print "–endofsection–\n";
header("Content-type: multipart/x-mixed-replace;boundary=endofsection");
print "--endofsection\n";//这里确保输出大于缓冲区大小长度的内容,str_repeat()函数, 各浏览器通用长度为:1024, 然后就能达到你想要的效果.