<?php
for ($i=0; $i<10; $i ) {
ob_start();
echo "This is iteration $i: ";
// * Dont do this!
// $buf = ob_get_contents();
// ob_clean();
// * Use this instead:
$buf = ob_get_flush();
//<SPAN >緩沖區關閉,竟然還有內容</SPAN>
$test=ob_get_contents();
echo $test,---->;
echo $buf;
echo memory_get_usage()." ";
echo <br />;
}
?>
<?php
for ($i=0; $i<10; $i ) {
ob_start();
echo "This is iteration $i: ";
// * Dont do this!
// $buf = ob_get_contents();
// ob_clean();
// * Use this instead:
$buf = ob_get_flush();
//緩沖區關閉,竟然還有內容
$test=ob_get_contents();
echo $test,---->;
echo $buf;
echo memory_get_usage()."";
echo <br />;
}
?>
ob_get_flush相當於ob_end_flush,只有一點區別,ob_get_flush獲取緩存區內容,保存到變量中,並關閉緩存區。