Using Output buffer to store contents in a file useful for reports invoices etc

suggest change
<?php
ob_start();
?>
    <html>
    <head>
        <title>Example invoice</title>
    </head>
    <body>
    <h1>Invoice #0000</h1>
    <h2>Cost: &pound;15,000</h2>
    ...
    </body>
    </html>
<?php
$html = ob_get_clean();

$handle = fopen('invoices/example-invoice.html', 'w');
fwrite($handle, $html);
fclose($handle);

This example takes the complete document, and writes it to file, it does not output the document into the browser, but do by using echo $html;

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents