The ultimate goal of php to achieve pure static page is to generate pure html file, and this pure html file is stored in the server's disk;
What php needs to achieve pure static page:
1. File writing function
file_put_contents(), or functions such as fopen(), fwrite(), fclose();
2, buffer (cache) operation function
ob function (ob_start() , ob_get_contents(), ob_clear(), ob_get_clearn(), etc.);
ob_start() — open the "output control buffer";
ob_get_contents() — return the "contents of the output buffer";
ob_clearn() — clear (erase) the "output buffer";
ob_get_clearn() — get the contents of the current buffer and delete the current "output buffer";
said in a previous article However, when we are executing a php program, if the php program has data output, then the data will first be output to the php buffer, and then the buffer will transmit the data to the client through tcp and display it;
So with the above ob function (output control buffer function), we can achieve our goal by controlling the output of the buffer, which is to achieve the staticization of the
page;
The above introduces the staticization of PHP pages - the principle of realizing pure staticization of pages, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.