Basic usage

Example #1 Output Control example

<?php

ob_start
();
echo 
"Hello\n";

setcookie("cookiename""cookiedata");

ob_end_flush();

?>

In the above example, the output from echo would be stored in the output buffer until ob_end_flush() was called. In the mean time, the call to setcookie() successfully stored a cookie without causing an error. (Headers cannot normally be sent to the browser after data has already been sent.)

Коментарии

<?php
function  ob($function){
ob_start();
$function();
$produced ob_get_contents();
ob_end_clean();
return 
$produced;
}
echo 
ob(function(){echo 123;})=='123'?"echo captured\n":'';
2019-02-25 15:40:12
http://php5.kiev.ua/manual/ru/outcontrol.examples.basic.html

    Поддержать сайт на родительском проекте КГБ