码迷,mamicode.com
首页 > Web开发 > 详细

PHP缓冲区强制及时输出

时间:2015-08-06 14:56:37      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:

string ‘{"multicast_id":4917012850725514945,"success":0,"failure":38,"canonical_ids":0,"results":[{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"Mismat‘... (length=1193)
string ‘{"multicast_id":4917012850725514945,"success":0,"failure":38,"canonical_ids":0,"results":[{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"MismatchSenderId"},{"error":"Mismat‘... (length=1193)
<script type="text/javascript">
function show_message(message) {
	document.getElementById(‘notice‘).innerHTML += message + ‘<br />‘;
	document.getElementById(‘notice‘).scrollTop = 100000000;
}


</script>

<div id="notice" style="width:950px; height: 200px; overflow:scroll; word-break: break-all; word-wrap:break-word;"></div>

<?php
// echo str_pad(" ", 256);  
// echo str_pad(" ", 1000);  // 保证缓冲区数量
function showjsmessage($message) {
	echo ‘<script type="text/javascript">show_message(\‘‘.addslashes($message).‘ \‘);</script>‘."\r\n";
	flush();
	ob_flush();
}

for ($i=0; $i < 100; $i++) {
	showjsmessage($i);
	sleep(1);
	// usleep(100000);
}
?>

  

PHP缓冲区强制及时输出

标签:

原文地址:http://www.cnblogs.com/adtuu/p/4707748.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!