d***@gmail.com
2019-10-16 17:12:12 UTC
In perl, you can use the select() operator to make
all your output go to a file. Is there something
similar in php4? I have a program with hundreds of
print() statements. I want to be able to save the
output to a file simultaniously. Suggestions?
================================all your output go to a file. Is there something
similar in php4? I have a program with hundreds of
print() statements. I want to be able to save the
output to a file simultaniously. Suggestions?
<?
// INSERT THIS BLOCK AT THE TOP OF THE FILE
ob_start();
?>
<html><body><? print("Hello!") ?></body></html>
<?
// INSERT THIS BLOCK AT THE BOTTOM OF THE FILE
$filename = "whatever.html";
$fp = fopen($filename, "w");
$out = ob_get_contents();
fwrite($fp, $out, strlen($out));
fclose($fp);
ob_end_clean();
?>
================================
JL