PHP Doku:: Schaltet die implizite Ausgabe ein bzw. aus - function.ob-implicit-flush.html

Verlauf / Chronik / History: (38) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDas Verhalten von PHP beeinflussenAusgabepufferungOutput-Control-Funktionenob_implicit_flush

Ein Service von Reinhard Neidl - Webprogrammierung.

Output-Control-Funktionen

<<ob_gzhandler

ob_list_handlers>>

ob_implicit_flush

(PHP 4, PHP 5)

ob_implicit_flush Schaltet die implizite Ausgabe ein bzw. aus

Beschreibung

void ob_implicit_flush ([ int $flag ] )

ob_implicit_flush() schaltet die implizite Ausgabe an oder aus. Die implizite Puffer-Ausgabe erzeugt eine Ausgabe nach jedem Ausgabe-Befehl, so dass keine Extra-Aufrufe von flush() mehr erforderlich sind.

Parameter-Liste

flag

TRUE schaltet implizite Ausgabe ein, FALSE schaltet sie aus. Vorgabewert ist TRUE.

Rückgabewerte

Es wird kein Wert zurückgegeben.

Siehe auch

  • flush() - Leert (sendet) den Ausgabepuffer
  • ob_start() - Ausgabepufferung aktivieren
  • ob_end_flush() - Leert (schickt/sendet) den Ausgabe-Puffer und deaktiviert die Ausgabe-Pufferung


4 BenutzerBeiträge:
- Beiträge aktualisieren...
rocca at start dot ca
9.10.2007 20:42
You can also get the unbuffered output with Linux/Apache without having to do the implicit flush after each line by calling:

ob_implicit_flush(true);
ob_end_flush();

...at the start of the script.
Paul Yanchenko
22.01.2006 1:15
There is another workaround for ob_implicit_flush() in console. Yes, it doesn't works as expected, but you can get similar result by specifying chunk_size=2 in ob_start():

<?php
  ob_start
('ob_logstdout', 2);
?>

This will result that every new line (which ends with \n) will flush output buffer.

Hope this will help you.
mhumphrey at _spammenot_designvision dot com
18.08.2003 23:41
From experimenting, it looks like using sessions with session.use_trans_sid=1 will force your output to be buffered regardless of this setting.

My guess is that this is so PHP can hunt for URLs in your output to automatically add the Session ID to them.  It must wait until script output is complete before it starts that replacement, rather than doing it "on the fly".

When i comment out my session_start() line, i get continuous output to the browser.  Put it back in, and i only see the page when it's completely loaded.  Change session.use_trans_sid = 0 and i get continuous output again.
calimero at Creatixnet dot com
7.07.2003 21:00
######### BEWARE ##########

There is a bug (or at least an unexpected feature of ob_implicit_flush) that has been already discussed on the PHP bugtracker :

http://bugs.php.net/bug.php?id=23877
http://bugs.php.net/bug.php?id=16676

Code like this WILL NOT work :

<?
// This will not work as expected on Linux.
ob_implicit_flush (1);
for(
$i=0;$i<10;$i++) {
   echo
"grrrrrrrrrr\n";
  
sleep(1);
}
?>

This feature happens on Linux versions of PHP, in all versions of php4 prior to 4.3.3 (don't know yet for the next ones) but also in php5 beta1. ob_implicit_flush has NO EFFECT on command-line (console, CLI) scripts, no flushing at all will be made, all output will be sent at the end of the script.

There is a workaround using ob_end_flush() and ob_flush, here it is :

<?
// This works !
ob_end_flush();
for(
$i=0;$i<10;$i++) {
  echo
"yeah :-))))\n";
  @
ob_flush();
 
sleep(1);
}
?>

hope this will help. It would have helped me...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)