Reply to Re: ob_start and ob_get_contents buffering problem

Your name:

Reply:


Posted by "Dasdan" on 10/07/05 13:38

Thanks a lot Petr !!


"Petr Smith" <pesmail2003@seznam.cz> wrote in message
news:8A.04.54476.21546434@pb1.pair.com...
> Dasdan wrote:
>> question:
>> I try to buffer the output of the 'system/views/main.php' into $contents.
>> and then do a print.
>> Problem is that the contents of the system/views/main.php are printed 2
>> times.
>> Someone who can explain me?
>> following the contents of testfile.php and main.php, php.ini settings
>> concerning ob_ ... functions and the output of the script.
>
> Hi,
>
> you have to use
>
> <?php
> // testfile.php
> ob_start();
> include 'browsers.html';
> $contents = ob_get_contents();
> ob_end_clean();
> print 'no output above normally ??? :(';
> print $contents;
> ?>
>
> because include goes to buffer, print's go to buffer and on the end the
> buffer is automatically flushed out. So it's the 2x - once for include,
> once for "print $contents"
>
> Simple eh?
>
> Petr

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация