简单index.php语句解释 (希望能解释到每一行)谢谢~

if(isset($_GET['upcache']) || !file_exists('index.html'))

{

require_once (dirname(__FILE__) . "/include/common.inc.php");

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();

}

}

if(isset($_GET['upcache']) || !file_exists('index.html')) //如果 upcache 这个参数存在,并且文件index.html也存在,那么执行条件体里的代码

{

require_once (dirname(__FILE__) . "/include/common.inc.php"); //引用这个文件,然后下面就可以使用这个文件里定义的变量、方法、类等等

require_once DEDEINC."/arc.partview.class.php";//同上

$GLOBALS['_arclistEnv'] = 'index';//把全局变量 _arclistEnv 的值设定为 'index',这个全局变量可能存在于上面两行代码中引用的文件或者上面文件中再次引用的其它文件,如此往上找;如果不存在这个全局变量,则这里就相当于声明定义了。

$row = $dsql->GetOne("Select * From `#@__homepageset`"); //用sql取数据、获取一个结果集

$row['templet'] = MfTemplet($row['templet']); //取其中的 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)

{ //显示类型 1

$pv->SaveToHtml(dirname(__FILE__).'/index.html'); //应该是保存一个html文件

include(dirname(__FILE__).'/index.html'); // 将这个index.html加载进来

exit();

} else { //其他显示类型

$pv->Display(); //

exit();

}

}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-11-21
这代码目测是缓存控制程序,如果收到更新缓存请求或者静态文件index.html不存在的时候执行下列代码:从数据库取出所需的数据=>填充模板=>如果后台开启缓存则将模板数据缓存起来,否则仅展示页面。

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网