Redirect stdout to file in php

<?php
ob_start();
echo ‘Your Name’;
$contents = ob_get_contents();
ob_end_clean();
file_put_contents(“test.txt”,$contents);
?>
Share

Leave a Reply

Your email address will not be published. Required fields are marked *