首页 > Web开发 > 详细

PHP缓冲区强制及时输出

时间:2015-08-06 14:54:46      阅读:395      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!