haidong 发表于 2010-2-24 13:43:51

用php实现边执行边输出的效果

<OL><LI><CODE><FONT face=新宋体>&lt;?php</FONT></CODE><LI><LI><CODE><FONT face=新宋体>/*</FONT></CODE><LI><CODE><FONT face=新宋体>@author:axgle &lt;axgle at 126 dot com&gt;</FONT></CODE><LI><LI><CODE><FONT face=新宋体>@note:要决是在每次flush显示前,输出str_pad("",10000)</FONT></CODE><LI><LI><CODE><FONT face=新宋体>@why:为什么非要10000?呵呵,大于10000也可以,我测试出来的</FONT></CODE><LI><LI><CODE><FONT face=新宋体>*/</FONT></CODE><LI><LI><CODE><FONT face=新宋体>print "一共5个档案要处理&lt;hr&gt;";</FONT></CODE><LI><CODE><A href="http://www.php.net/manual/zh/function.sleep"><FONT face=新宋体 color=#0000ff><U>sleep</U></FONT></A><FONT face=新宋体>(1);</FONT></CODE><LI><LI><CODE><FONT face=新宋体>print <A href="http://www.php.net/manual/zh/function.str_pad"><U><FONT color=#0000ff>str_pad</FONT></U></A>("",100000);</FONT></CODE><LI><CODE><A href="http://www.php.net/manual/zh/function.flush"><FONT face=新宋体 color=#0000ff><U>flush</U></FONT></A><FONT face=新宋体>();</FONT></CODE><LI><LI><CODE><FONT face=新宋体>for($i=1;$i&lt;=5;$i++)</FONT></CODE><LI><LI><CODE><FONT face=新宋体>{ </FONT></CODE><LI><LI><CODE><A href="http://www.php.net/manual/zh/function.sleep"><FONT face=新宋体 color=#0000ff><U>sleep</U></FONT></A><FONT face=新宋体>(1);</FONT></CODE><LI><LI><CODE><FONT face=新宋体>print"#$i 完毕&lt;hr&gt;";</FONT></CODE><LI><LI><CODE><FONT face=新宋体>print <A href="http://www.php.net/manual/zh/function.str_pad"><U><FONT color=#0000ff>str_pad</FONT></U></A>("",10000);</FONT></CODE><LI><CODE><A href="http://www.php.net/manual/zh/function.flush"><FONT face=新宋体 color=#0000ff><U>flush</U></FONT></A><FONT face=新宋体>();</FONT></CODE><LI><LI><CODE><FONT face=新宋体>}</FONT></CODE><LI><LI><CODE><FONT face=新宋体>print "恭喜,全部处理成功!";</FONT></CODE><LI><LI><CODE><FONT face=新宋体>?&gt;</FONT></CODE></LI></OL>
页: [1]
查看完整版本: 用php实现边执行边输出的效果