Reply to ob_start and ob_get_contents buffering problem

Your name:

Reply:


Posted by "Dasdan" on 10/07/05 10:03

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.

Thanks in advance,

Kevin Wood
http://www.dasdan.be

<?php
// testfile.php
ob_start();
include 'system/views/main.php';
$contents = ob_get_contents();

print 'no output above normally ??? :(';
print $contents;
?>

<?php
// file :system/views/main.php

print <<<P1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<title>The Task List</title>
</head>
<body>
<div>
<h3>test</h3>
<p>
</body>
</html>
P1;
?>

php.ini settings
.....
output_buffering = Off
output_handler =
zlib.output_compression = Off
implicit_flush = Off
.....


the output :


<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<title>The Task List</title>
</head>
<body>
<div>
<h3>test</h3>
<p>

</body>
</html>no output above normally ??? :(<!DOCTYPE HTML PUBLIC "-//W3C//DTD
XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<title>The Task List</title>
</head>
<body>
<div>
<h3>test</h3>
<p>

</body>
</html>

[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

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