"easiest way to convert a php page to static html page" Code Answer

3

you can use output buffers. if you have an html page, such as:

   <html>
      <head>
         <title>blah</title>
      </head>
      <body>
        some text here
      </body>
   </html>

then if you put, at the top of the html file:

<?php ob_start(); ?>

and right at the bottom, after the last tag, put:

<?php 
   $string = ob_get_contents(); 

   //do whatever you need to do to the html, save it to a seperate file, email it, etc

   ob_flush();
?>

what this basically means is that the $string variable will end up with the entire static html of the page, after it has been dynamically generated. you can then use that string in an email. although really, html pages don't work exactly the same in emails, so you may want to rethink the approach.

By Tobias Nawa on May 29 2022

Answers related to “easiest way to convert a php page to static html page”

Only authorized users can answer the Search term. Please sign in first, or register a free account.