php 及时输出消息

<?php
	header('Content-type: text/html; charset=UTF-8');
	set_time_limit( 300 );
	ob_end_clean();
	
	apache_setenv('no-gzip', 1);
	ini_set('zlib.output_compression', 0);
	ini_set('implicit_flush', 1);
	ob_start();//开始缓冲数据
?>
<style>
<!--
#notice {
    height: 300px;
    overflow: hidden;
    padding: 5px;
    text-align: left;
    border: 1px solid #B5CFD9;
    height: 100px;
    padding: 5px;
    text-align: left;
    width: 620;
}
-->
</style>


<script type="text/javascript">
	var i=0;
	function showmessage(message) 
	{
		i++;
		if ( i%1000 == 0)
		{
			document.getElementById("notice").innerHTML = "";	
		}
		document.getElementById("notice").innerHTML += message + "<br />";
		document.getElementById("notice").scrollTop = 200000;
	}
</script>

<div id="notice">
</div>

<?php 
	for( $i = 1; $i <= 600; $i++ )
	{
	    $message = "正在安装.... {$i}";
	    //echo $message.'<br>';
	    echo '<script type="text/javascript">showmessage("'
	    		. $message.str_repeat(" ", 4096).'");</script><br>';//ie有默认的1k buffer
	    //echo $i.'<br>';
	    ob_flush();
		flush();
	}
	
	exit;
?>



你可能感兴趣的:(apache,html,PHP,IE)