Re: Re: Outputting HTML with PHP - Buffer Problem?

From: Date: Mon, 13 Sep 2004 19:03:51 +0000
Subject: Re: Re: Outputting HTML with PHP - Buffer Problem?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-196550@lists.php.net to get a copy of this message
* Thus wrote M. Sokolewicz: > Nick Wilson wrote: > >Hi all, > > > >Say i have a php script like this: > > > ><?php > > print(html_head()); > > // do loads of time taking stuff > > print(html_footer()); > >?> > > > >How come I dont see the html header (it's just a function that returns a > >string with the html up till <body>) before the entire script has run? > > > >This goes against my understanding, why might this be and what might i > >use to get some output before the script has finished executing? > > > >Much thanks... > that's because it's all sent as 1 single big chunk of data. To get > around this, you should set implicit_flush to 1 (it's in php.ini). > Otherwise, you can also use the PHP ob_implicit_flush() to do this. > Setting it to 1 will flush the output buffer everytime it's written to, > if set to 0 it will do as normal, and buffer it all to send it together. Actually by default its sent in chunks of 4K. I wouldn't suggest implicit flushing, just a simple buffer flush after the head(). Curt -- The above comments may offend you. flame at will.

« previous php.general (#196550) next »