Home > Article > Backend Development > Introduction to PHP page staticization, php page static_PHP tutorial
/**
*PHP page staticization is divided into the following steps:
*1. Turn on the output control cache
*2. Return the contents of the output buffer
*3. Write a string to the file
*4. Flush the contents of the cache
*/
//1. Turn on the output control cache
ob_start();
?>
//2. Return the contents of the output buffer
$contents = ob_get_contents();
//3. Write a string to the file
file_put_contents("newindex.html",$contents);
//4. Flush the contents of the cache area
ob_flush();
?>