国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > PHP > 正文

PHP動態(tài)網頁實現靜態(tài)HTML技術的方法實現

2024-05-04 23:03:12
字體:
來源:轉載
供稿:網友

<?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",
                        "http://./././e",
                        "http://.///./e",
                        "http://././/http://///ies",
                        "http://././/#/",
                        "http://'/./'/e",
                        "http://././/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靜態(tài)頁面展示(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處理尾
?>

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 明溪县| 龙井市| 农安县| 怀仁县| 浮山县| 永仁县| 河西区| 邓州市| 马边| 晋江市| 南雄市| 堆龙德庆县| 五华县| 措美县| 长海县| 宁化县| 泰州市| 伊春市| 宜兰市| 江安县| 九寨沟县| 西吉县| 名山县| 怀安县| 临武县| 伊宁市| 景德镇市| 长泰县| 通江县| 聂荣县| 邮箱| 广丰县| 祥云县| 上思县| 青铜峡市| 青海省| 泽普县| 吴川市| 河北省| 内乡县| 巴南区|