PHP Write Echo content to file

You can get the echo content to variable as fallows

ob_start(); echo '<html>'; echo '<div>';
 echo 'TEST PRINT';
echo '</div>'; echo '</html>'; $content = ob_get_clean();

Write the echo content to file can achieve as fallows

$fp = fopen($_SERVER['DOCUMENT_ROOT'] . "/test.html","wb"); fwrite($fp,$content); fclose($fp);




Comments

Popular posts from this blog

ENOENT: no such file or directory, rename : node_modules/async

react-quill Integrate quill-image-resize-module