//授權的初始化源代碼
函數init_checker()
{
$domain_array = array(
base64 _ encode(base64 _ encode(' localhost ')),
);
$ str = base64 _ encode(base64 _ encode(serialize($ domain _ array))。"|".serialize($ domain _ array));
$arr = explode("| ",base64 _ decode($ str));
$ arr = unserialize($ arr[1]);
foreach($ arr as $ k = & gt;$v)
{
$ arr[$ k]= base64 _ decode(base64 _ decode($ v));
}
$ HOST = $ _ SERVER[' HTTP _ HOST '];
$host = explode(":",$ host);
$ host = $ host[0];
if(preg_match("/\d+\。\d+\。\d+\。\ d+//,$host))返回true
$ passed = false
foreach($ arr as $ k = & gt;$v)
{
if(substr $ v,0,2)= ' * . ')
{
$preg_str = substr($v,2);
if(preg _ match(“/”。$preg_str。" $/",$ host)& gt;0)
{
$ passed = true
打破;
}
}
}
如果(!$通過)
{
如果(!in_array($host,$arr))
{
返回false
}
}
返回true
}
$ checker = init _ checker();
如果(!$checker)die(“域未授權”);
//定義緩存
需要APP_ROOT_PATH。system/cache/cache . PHP ';
$ cache = CacheService::getInstance();
require_once APP_ROOT_PATH。”system/cache/cachefileservice . PHP”;
$ f cache = new CacheFileService();//專用於存儲靜態數據的緩存實例。
$ f cache-& gt;set_dir(APP_ROOT_PATH。" public/runtime/data/";
//結束定義緩存
//定義數據庫
需要APP_ROOT_PATH。system/db/db . PHP ';
define('DB_PREFIX ',app _ conf(' DB _ PREFIX ');
如果(!文件存在(應用程序根路徑。public/runtime/app/db_caches/'))
mkdir(APP_ROOT_PATH。public/runtime/app/db_caches/',0777);
$ pconnect = false
$ DB = new MySQL _ DB(app _ conf(' DB _ HOST ')。":".app_conf('DB_PORT ')、app_conf('DB_USER ')、app_conf('DB_PWD ')、app_conf('DB_NAME ')、' utf8 '、$ p connect);
//結束定義數據庫
//定義模板引擎
需要APP_ROOT_PATH。system/template/template . PHP ';
如果(!文件存在(應用程序根路徑。public/runtime/app/tpl_caches/'))
mkdir(APP_ROOT_PATH。public/runtime/app/tpl_caches/',0777);
如果(!文件存在(應用程序根路徑。public/runtime/app/TPL _ compiled/'))
mkdir(APP_ROOT_PATH。public/runtime/app/TPL _ compiled/',0777);
$ tmpl = new AppTemplate
//結束定義模板引擎。
$_REQUEST = array_merge($_GET,$ _ POST);
filter _ REQUEST($ _ REQUEST);
& gt