600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > PHP动态网页实现静态HTML技术办法实现

PHP动态网页实现静态HTML技术办法实现

时间:2024-06-07 17:42:06

相关推荐

PHP动态网页实现静态HTML技术办法实现

php教程|php手册

nbsp,HTML,FILE,tpl,php

php教程-php手册

<?php

/*____生成HTML文件________beign__________*/

if ($make_html)

{

$buffer = ob_get_flush();

if ($go_html)//是否直接转到HTML文件显示还是PHP读得内容输出(0:php读内容输出1:直接转)

{

/*__处理因生成了HTML文件而产生的种径问题______begin_______*/

$search = array(

“/(src=|action=|href=|ajaxRead\()\”/ie”,

“/\.\.\./e”,

“/\.\/\./e”,

“/\.\.\/http:\/\//ies”,

“/\.\.\/#/”,

“/\’\.\’/e”,

“/\.\.\/javascript:/ies”);

$replace = array(

“‘\\1\”../”,

“‘..”,

“‘.”,

“‘http://”,

“#”,

“‘\’..\””,

“‘javascript:”);

$buffer = preg_replace($search, $replace, $buffer);

/*___处理因生成了HTML文件而产生的种径问题_____end_____*/

}

$fp = fopen(HTML_FILE, “w”);

if ($fp)

{

fwrite($fp, $buffer);

fclose($fp);

}

}

/*_______生成HTML文件_________beign________*/

?>

<?php

ob_start();

/*____判断是否已生成了HTML文件,若生成了则跳转到HTML页面___begin_____*/

$qstring = isset($_SERVER[“QUERY_STRING”]) ? $_SERVER[“QUERY_STRING”] : “”;

if ($qstring)//程序加了GET请求的处理

{

$qstring = str_replace(“=”, “”, $qstring);

define(“HTML_FILE”, “./h/{$efilename}-{$qstring}.html”);

}

else

{

define(“HTML_FILE”, “./h/{$efilename}.html”);

}

if (file_exists(HTML_FILE))

{

$lcft = filemtime(HTML_FILE);//last create file time

if (($lcft + 3600) > time())//判断上次生成HTML文件是否以过去1时间,若没有才直接输出文件内容

{

if ($show_html)//是否以HTML静态页面展示(0不以HTML展显1以html展显)

{

if ($go_html)//是否直接转到HTML文件显示还是PHP读得内容输出(0:php读内容输出1:直接转)

{

header(“Location: ” . HTML_FILE);//直接转

}

else

{

echo(file_get_contents(HTML_FILE));//读出展显

}

exit(0);

}

}

}

/*___判断是否已生成了HTML文件,若生成了则跳转到HTML页面_____end_____*/

?>

<?php

require(“woods-thtml.php”);//生成HTML处理头

//if (count($_GET) < 1 && count($_POST) < 1){require("woods-thtml.php");}//生成HTML处理头

require(“{$exec_file}”);//注册语言定义文件

foreach ($lang as $key => $value)

{

$atpl[strtoupper($key) .”_LANG”] = $value;

}

/*__________列表常识向上走的项_______end_______*/

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处理尾

?>

第三方分销微商城免费开源源码,ubuntu 终端多窗口,梦见被爬虫咬,旧版本网站如何兼容php5,seo基本结构lzw

商品报价源码php源码,ubuntu模拟qq音乐,把项目到tomcat服务器,爬虫获取网页地址,php技术社区源代码外包,seo诊断培训lzw

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。