Php static file generation
Php static file generation
Ob_start (); # enable the server cache include_once 'Index. php '; $ ctx = ob_get_contents (); # get the cache ob_end_clean (); # clear the cache $ fh = fopen ("index.html", "w +"); fwrite ($ fh, $ ctx); # write html to generate html fclose ($ fh);/* 1. Flush: refresh the buffer content and output it. Function format: flush () Description: This function is frequently used and highly efficient. 2. ob_start: format of the function used to open the output buffer: void ob_start (void) description: When the buffer is activated, all non-file header information from the PHP program is not sent, but saved in the internal buffer zone. To output the buffer content, you can use ob_end_flush () or flush () to output the buffer content. 3. ob_get_contents: returns the content of the internal buffer. Function format: string ob_get_contents (void) Description: This function returns the content in the current buffer. if the output buffer is not activated, FALSE is returned. 4. ob_get_length: return the length of the internal buffer. Usage: int ob_get_length (void) Description: This function returns the length of the current buffer. it is the same as ob_get_contents if the output buffer is not activated. Returns FALSE. 5. ob_end_flush: sends the content of the internal buffer to the browser and closes the output buffer. Usage: void ob_end_flush (void) Description: This function sends the content of the output buffer (if any ). 6. ob_end_clean: delete the content of the internal buffer and disable the use of the internal buffer. void ob_end_clean (void): This function will not delete the content of the internal buffer! 7. ob_implicit_flush: How to enable or disable absolute refresh: void ob_implicit_flush ([int flag]) */
The above is the content of the static file generated by php. For more information, see PHP Chinese network (www.php1.cn )!