下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、The train of thought of the theme PHP gen erate static HTML pages is the PHP script returns HTML in formatio n is writte n to a.Html or.Htm file1php生成html大致可以用两种方法,第一种使用模板,第二种方法使用ob函数。1php HTML can be gen erated by two methods, the first use of the template, sec ond methods of using ob fun cti on.2第
2、一种方法:使用模板2 the first method: using a template我习惯用的是smarty模板,smarty模板中有一个获取输出内容的函数fetch(),利用这个方法可以将获取的内容写入到html文件中。I used to use Smarty templates, one to get the output function fetch (Smarty template), this method can be used to write the content to the HTML file.这是一个简易的执行代码,如下:This is a simple code
3、 executi on, as follows:require('smarty/;-Require ('smarty/; China$t = new Smarty;-$t = new Smarty;$t->assig n("title","Hello World!");-$t->assig n ("title", "Hello World!");$content = $t->fetch("templates/index.htm");-$content = $t-
4、>fetch ("templates/in dex.htm");$fp = fope n("./0001.html", "w");-$fp = fope n ("./0001.html", "W");fwrite($fp, $content);-Fwrite ($fp, $content); Ch ina fclose($fp);-Fclose ($fp); Chi na3第二种方法:使用ob系列函数3 sec ond methods: using ob series function用到
5、的 ob 系列函数有:ob_start(), ob_end_flush(), ob_get_content()。其中 ob_start()是打开浏 览器缓冲区的意思,所有来自PHP程序的非文件头信息均不会发送,而是保存在内部缓冲区,直到使用了 ob_end_flush()。ob_get_contents()这个函数的作用是获取缓冲区的内容,相 当于上面的那个 fetch()。OB series function: ob_start (), ob_e nd_flush (), ob_get_c onten t (). The ob_start () is to ope n the browser
6、 buffer means, sending all from the PHP program of non file header in formati on is not, but stored in an internal buffer, until the use of ob_end_flush (). (ob_get_contents) this function to obta in the contents of the buffer, the fetch is equivale nt to (above).写的一个简易的执行代码如下:A simple executable code writte n as follows:ob_start();-Ob_start (Chi na)echo "Hello World!"-Echo "Hello World!"$content = ob_get_c onten ts();$content = ob_get_c ontents ();$fp = fope n("./0002.html", "w");-$fp = fope n ("./000
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 基层安全生产会议制度
- 航空餐具生产制度
- 生产车间地面保护制度
- 2026吉林吉林省高速公路集团有限公司白城分公司劳务派遣项目招聘1人参考考试题库附答案解析
- 2026广东佛山顺德区杏坛伍蒋惠芳实验初级中学招聘化学临聘教师1人参考考试试题附答案解析
- 全员安全生产培训制度
- 冻品生产规章制度
- 2026浙江嘉兴市海宁市马桥派出所招聘马桥街道流动人口协管员3人参考考试题库附答案解析
- 村社区安全生产宣传制度
- 2026湖北荆州市洪湖市事业单位人才引进100人备考考试试题附答案解析
- 中国急性胰腺炎诊治指南解读2019
- 2023年杭州市临平区事业单位笔试试题
- 幼儿学前班数学寒假作业25
- 2024年钢丝绳索具相关项目创业计划书
- 幼小衔接数学计算每日一练39天(幼儿园大班)
- 基于蛋白代谢多组学探讨参麻益智方治疗高血压合并血管性痴呆大鼠作用机制演示稿件
- 上海布邦流体过滤产品知识课件
- 建筑施工人员三级安全教育
- 全国优质课一等奖职业学校教师信息化大赛《语文》(基础模块)《我愿意是急流》说课课件
- 石泉县安沟钛磁铁矿矿山地质环境保护与土地复垦方案
- 成长作文500字五年级
评论
0/150
提交评论