<BR>ob_start();#开启服务器缓存 <BR>include_once 'Index.php'; <BR>$ctx=ob_get_contents();# 获取缓存 <BR>ob_end_clean();#清空缓存 <BR>$fh=fopen("index.html","w+"); <BR>fwrite($fh,$ctx);# 写入html,生成html <BR>fclose($fh); <BR>
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 <BR>/////////////////////////////////////////////////////////////////////////////// <BR>// <BR>// 张树林 - 慧佳工作室 <BR>// <BR>// Module Name: woods-bhtml.php <BR>// Abstract: 生成静态HTML处理程序尾底 <BR>// Version: 2.0 <BR>// Date 1006-11-25 <BR>// Author: woods·zhang <BR>// Website: http://www.hoojar.com/ <BR>// Email: [email protected] <BR>// MSN: [email protected] <BR>// Copyright 1001-1006, Hoojar studio All Rights Reserved <BR>// <BR>// 版权 1001-1006,慧佳工作室所有版权保护 <br><br>//The software for free software, allowing use, copy, <BR>//modify and distribute the software and files. Any <BR>//use of this software must place a copy of all the <BR>//above copyright notice. By the software Huijia studio <BR>//maintenance, if you have any queries please contact us. <BR>//Thank you. <BR>// <BR>//此软件为自由软件,允许使用、拷贝、修改、分发本软件及其文档。 <BR>//任何使用此软件的地方都得出现以上版权通告所有副本。此软件由 <BR>//慧佳工作室维护,如果您有什么疑问请与我们联系。谢谢使用。 <BR>// <BR>/////////////////////////////////////////////////////////////////////////////// <BR>//此文件只能加载在程序的最尾 <BR>/*________________生成HTML文件______________________beign________________________________*/ <BR>if ($make_html) <BR>{ <BR>$buffer = ob_get_flush(); <BR>if ($go_html)//是否直接转到HTML文件显示还是PHP读得内容输出(0:php读内容输出1:直接转) <BR>{ <BR>/*__________处理因生成了HTML文件而产生的种径问题____________________begin_______________*/ <BR>$search = array( <BR>"/(src=|action=|href=|ajaxRead\()\"/ie", <BR>"/\.\.\./e", <BR>"/\.\/\./e", <BR>"/\.\.\/http:\/\//ies", <BR>"/\.\.\/#/", <BR>"/\'\.\'/e", <BR>"/\.\.\/javascript:/ies"); <br><br>$replace = array( <BR>"'\\1\"../'", <BR>"'..'", <BR>"'.'", <BR>"'http://'", <BR>"#", <BR>"'\'..\''", <BR>"'javascript:'"); <BR>$buffer = preg_replace($search, $replace, $buffer); <BR>/*__________处理因生成了HTML文件而产生的种径问题____________________end_______________*/ <BR>} <br><br>$fp = fopen(HTML_FILE, "w"); <BR>if ($fp) <BR>{ <BR>fwrite($fp, $buffer); <BR>fclose($fp); <BR>} <BR>} <BR>/*________________生成HTML文件______________________beign________________________________*/ <BR>?> <br><br><?php <BR>/////////////////////////////////////////////////////////////////////////////// <BR>// <BR>// 张树林 - 慧佳工作室 <BR>// <BR>// Module Name: woods-thtml.php <BR>// Abstract: 生成静态HTML处理程序头 <BR>// Version: 2.0 <BR>// Date 1006-11-25 <BR>// Author: woods·zhang <BR>// Website: http://www.hoojar.com/ <BR>// Email: [email protected] <BR>// MSN: [email protected] <BR>// Copyright 1001-1006, Hoojar studio All Rights Reserved <BR>// <BR>// 版权 1001-1006,慧佳工作室所有版权保护 <br><br>//The software for free software, allowing use, copy, <BR>//modify and distribute the software and files. Any <BR>//use of this software must place a copy of all the <BR>//above copyright notice. By the software Huijia studio <BR>//maintenance, if you have any queries please contact us. <BR>//Thank you. <BR>// <BR>//此软件为自由软件,允许使用、拷贝、修改、分发本软件及其文档。 <BR>//任何使用此软件的地方都得出现以上版权通告所有副本。此软件由 <BR>//慧佳工作室维护,如果您有什么疑问请与我们联系。谢谢使用。 <BR>// <BR>/////////////////////////////////////////////////////////////////////////////// <BR>//此文件只能加载在程序的开头 <BR>ob_start(); <BR>/*___________判断是否已生成了HTML文件,若生成了则跳转到HTML页面___________begin__________*/ <BR>$qstring = isset($_SERVER["QUERY_STRING"]) ? $_SERVER["QUERY_STRING"] : ""; <BR>if ($qstring)//程序加了GET请求的处理 <BR>{ <BR>$qstring = str_replace("=", "", $qstring); <BR>define("HTML_FILE", "./h/{$efilename}-{$qstring}.html"); <BR>} <BR>else <BR>{ <BR>define("HTML_FILE", "./h/{$efilename}.html"); <BR>} <BR>if (file_exists(HTML_FILE)) <BR>{ <BR>$lcft = filemtime(HTML_FILE);//last create file time <BR>if (($lcft + 3600) > time())//判断上次生成HTML文件是否以过去1时间,若没有才直接输出文件内容 <BR>{ <BR>if ($show_html)//是否以HTML静态页面展示(0不以HTML展显1以html展显) <BR>{ <BR>if ($go_html)//是否直接转到HTML文件显示还是PHP读得内容输出(0:php读内容输出1:直接转) <BR>{ <BR>header("Location: " . HTML_FILE);//直接转 <BR>} <BR>else <BR>{ <BR>echo(file_get_contents(HTML_FILE));//读出展显 <BR>} <BR>exit(0); <BR>} <BR>} <BR>} <BR>/*___________判断是否已生成了HTML文件,若生成了则跳转到HTML页面___________end__________*/ <BR>?> <br><br><?php <BR>/////////////////////////////////////////////////////////////////////////////// <BR>// <BR>// 张树林 - 慧佳工作室 <BR>// <BR>// Module Name: index.php <BR>// Abstract: 首页信息 <BR>// Version: 1.0 <BR>// Date 2006-11-7 <BR>// Author: woods·zhang <BR>// Website: http://www.hoojar.com/ <BR>// Cemail: [email protected] <BR>// MSN: [email protected] <BR>// Copyright 2001-2006, Hoojar studio All Rights Reserved <BR>// <BR>// 版权 2001-2006,慧佳工作室所有版权保护 <br><br>//The software for free software, allowing use, copy, <BR>//modify and distribute the software and files. Any <BR>//use of this software must place a copy of all the <BR>//above copyright notice. By the software Huijia studio <BR>//maintenance, if you have any queries please contact us. <BR>//Thank you. <BR>// <BR>//此软件为自由软件,允许使用、拷贝、修改、分发本软件及其文档。 <BR>//任何使用此软件的地方都得出现以上版权通告所有副本。此软件由 <BR>//慧佳工作室维护,如果您有什么疑问请与我们联系。谢谢使用。 <BR>// <BR>/////////////////////////////////////////////////////////////////////////////// <BR>require("woods-thtml.php");//生成HTML处理头 <BR>//if (count($_GET) < 1 && count($_POST) < 1){require("woods-thtml.php");}//生成HTML处理头 <br><br>require("{$exec_file}");//注册语言定义文件 <BR>foreach ($lang as $key => $value) <BR>{ <BR>$atpl[strtoupper($key) ."_LANG"] = $value; <BR>} <BR>/*____________________________________列表常识向上走的项__________________end<strong>2本文来源gaodaima#com搞(代@码$网6</strong><pre>搞gaodaima代码
_____________________*/
include(“woods-templates.php”);
$tpl = new WoodsTpl(“./templates/”);
$tpl->require_tpl(“header.html”);
$tpl->set_file();
$tpl->block(“EBCORP”, $scorp);
$tpl->block(“NEWS”, $news);
$tpl->block(“PRODUCT”, $product);
$tpl->block(“EBPNAME_MSG”, $spname);
$tpl->block(“LORE”, $lore);
$tpl->require_tpl(“footer.html”);
$tpl->parse($atpl, true);
$tpl = NULL;
/*________________模板操作_________________________end___________________________________*/
require(“woods-bhtml.php”);//生成HTML处理尾
?>