- PHP :
ob_start();
:
$output = ob_get_clean();
file_put_contents('filename', $output);
And if you also want to output it for this process (for example, if you want to write cache at runtime, but also show this page to this user:
echo $output;
source
share