flush() Not displaying output in PHP? -


i have code:

   set_time_limit(0);    header("cache-control: no-cache, must-revalidate");    header("expires: mon, 26 jul 1997 05:00:00 gmt");    ob_flush();    flush();    $start = time();    $secs = time() - $start;    while ($secs <= 300)    {              echo "this script has been running $secs seconds.\n";         ob_flush();         flush();         sleep(1);    } 

what i'd when view page, see in real time how long script has been running, this:

  • script has been running 1 seconds.
  • script has been running 2 seconds.
  • ............
  • script has been running 300 seconds.

instead blank window continuous 'loading' sign 5 minutes, , after 5 mins i'm bombarded load of these messages should've been getting 1 message @ time.

can explain i'm doing wrong?

ob_flush not flush. ob_flush clears object buffer that's been opened. since don't have object buffer open, nothing flushed.

also, web browsers , web server software notorious holding data until can outputted. make sure gziping turned off , you're using sane browser.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -