ob_start();#开启服务器缓存 include_once 'Index.php'; $ctx=ob_get_contents();#获取缓存 ob_end_clean();#清空缓存 $fh=fopen("index.html","w+"); fwrite($fh,$ctx);#写入html,生成html fclose($fh); /* 1、Flush:刷新缓冲区的内容,输出。 函数格式:flush() 说明:这个函数经常使用,效率很高。 2、ob_start :打开输出缓冲区 函数格式:void ob_start(void) 说明:当缓冲区激活时,所有来自PHP程序的非文件头信息均不会发送,而是保存在内部缓冲区。 为了输出缓冲区的内容,可以使用ob_end_flush()或flush()输出缓冲区的内容。 3 、ob_get_contents :返回内部缓冲区的内容。 使用 函数格式:string ob_get_contents(void) 说明:这个函数会返回当前缓冲区中的内容,如果输出缓冲区没有激活,则返回 FALSE 。 4、ob_get_length:返回内部缓冲区的长度。 使用方法:int ob_get_length(void) 说明:这个函数会返回当前缓冲区中的长度;和ob_get_contents一样,如果输出缓冲区没有激活。则返回 FALSE。 5、ob_end_flush :发送内部缓冲区的内容到浏览器,并且关闭输出缓冲区。 使用方法:void ob_end_flush(void) 说明:这个函数发送输出缓冲区的内容(如果有的话)。 6、ob_end_clean:删除内部缓冲区的内容,并且关闭内部缓冲区 使用方法:void ob_end_clean(void) 说明:这个函数不会输出内部缓冲区的内容而是把它删除! 7、ob_implicit_flush:打开或关闭绝对刷新 使用方法:void ob_implicit_flush ([int flag]) */
以上就是php生成静态文件的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use