How to capture content from the output buffer ? or Give me an example for Output caching in php?
ob_start(); // start an output buffer
echo ‘This text is from the w3answers buffer*******
’; // output that will be stored in the buffer
$w3buffer = ob_get_contents(); // store buffer content in $w3buffer variable
ob_end_clean(); // stop and clean the output buffer
echo ‘This is not from the w3answers buffer!!!!!!!!
’;
echo $w3buffer;
?>
Explore posts in the same categories: PHP Interview Questions