Ben verileri almak için 10 farklı sunucular bağlanır bir php komut dosyası var. Ben ikinci bir başlamadan önce 1 bağlantının sonuçlarını yazdırmak istiyorum.
flush
and/or ob_flush
a>, ne istediğinizi almalısınız kullanma.
Burada hızlı bir gösteri:
for ($i=0 ; $i<10 ; $i++) {
echo "$i<br />";
ob_flush();
flush();
sleep(1);
}
Each second, a number will be sent to the browser, without waiting for the loop/script to end.
(Without both flush and ob_flush
, it waits until the end of the script to send the output)
Explanation about why you need both, quoting from the flush page in the manual :
Flushes the write buffers of PHP and whatever backend PHP is using (CGI, a web server, etc). This attempts to push current output all the way to the browser with a few caveats.
flush() may not be able to override the buffering scheme of your web server and it has no effect on any client-side buffering in the browser. It also doesn't affect PHP's userspace output buffering mechanism. This means you will have to call both ob_flush() and flush() to flush the ob output buffers if you are using those.
If this doesn't work for you, taking a look at the comments on the two pages of the manual can give you a couple of pointers on "why it could fail"
ob_end_flush http://us.php.net/ob%5Fend%5Fflush
Bu fonksiyon Çıktı tamponunu boşaltır ve tamponu kapatır. Bu fonksiyon sonra her şey hemen tarayıcıya gönderilir.