问题
i have this script:
<?php
header('Content-type: multipart/x-mixed-replace;boundary=endofsection');
print "\n--endofsection\n";
$pmt = array("-", "\\", "|", "/" );
for( $i = 0; $i <10; $i ++ ){
sleep(1);
print "Content-type: text/plain\n\n";
print "Part $i\t".$pmt[$i % 4]."<br />";
print "--endofsection\n";
ob_flush();
flush();
}
print "Content-type: text/plain\n\n";
print "The end\n";
print "--endofsection--\n";
?>
This scripts works well.. The problem is when the data flushed the previous messages dissapeared.. How can i fix this script? Thx for advance!!
Edit Well i fix what i was asking with this code:
<?php
header('Content-type: multipart/mixed;boundary=endofsection');
//print "\n--endofsection\n";
$pmt = array("-", "\\", "|", "/" );
print "Content-type: text/plain\n\n";
for( $i = 0; $i <10; $i ++ ){
sleep(1);
echo "Part $i\t".$pmt[$i % 4]." \n";
//ob_flush();
flush();
};
print "The end\n";
print "--endofsection--\n";
?>
The problem now is that i don't have line break with <br/>
I see it also into the screen
来源:https://stackoverflow.com/questions/8734820/php-flush-function