dede 5.7 入口檔案解讀
阿新 • • 發佈:2019-01-08
<?php
// __FILE__ 檔案的完整路徑和檔名 D:\phpStudy\WWW\hospital\local.mtpcwh.com\index.php
// dirname() 函式返回路徑中的目錄部分。dirname(__FILE__) D:\phpStudy\WWW\hospital\local.mtpcwh.com
if(!file_exists(dirname(__FILE__).'/data/common.inc.php'))
{
// 資料庫配置檔案common.inc.php 不存在 則說明未安裝,跳轉到安裝介面
header('Location:install/index.php' );
exit();
}
//自動生成HTML版
// 如果url中有upchche引數 或者根目錄下不存在index.html檔案 則自動生成HTML
if(isset($_GET['upcache']) || !file_exists('index.html'))
{
// 引入檔案配置選項
require_once (dirname(__FILE__) . "/include/common.inc.php");
// DEDEINC : D:/phpStudy/WWW/hospital/local.mtpcwh.com/include
require_once DEDEINC."/arc.partview.class.php" ; // 載入檢視類
$GLOBALS['_arclistEnv'] = 'index'; //設定一個變數
$row = $dsql->GetOne("Select * From `#@__homepageset`"); // 主頁設定表
$row['templet'] = MfTemplet($row['templet']); //模板目錄規則
$pv = new PartView(); // 例項化檢視類
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']); // 呼叫模板
$row['showmod'] = isset($row['showmod'])? $row['showmod'] : 0; //展現模式
if ($row['showmod'] == 1)
{
$pv->SaveToHtml(dirname(__FILE__).'/index.html'); //生成靜態首頁
include(dirname(__FILE__).'/index.html'); // 包含首頁檔案
exit();
} else {
$pv->Display();
exit();
}
}
else
{
header('HTTP/1.1 301 Moved Permanently'); // index.html已存在
header('Location:index.html');
}
?>