DoYouHaoBaby示例之:静态页面生成

设置页面生成静态和有效期

当前时间:2011-12-11 12:49:57
刷新页面 后注意看时间是否有变化
示例源码

配置文件Config.php

<?php
/**

 //  The DoYouHaoBaby PHP FrameWork - html
 //  +---------------------------------------------------------------------
 //
 //  “Copyright”
 //  +---------------------------------------------------------------------
 //     | (C) 2010 - 2011 http://doyouhaobaby.net All rights reserved.
 //     | This is not a free software, use is subject to license terms
 //  +---------------------------------------------------------------------
 //
 //  “About This File”
 //  +---------------------------------------------------------------------
 //     | html 基本配置文件
 //  +---------------------------------------------------------------------

*/

!defined('DYHB_PATH') && exit;

$arrConfigs = array(

   
'HTML_CACHE_ON'=>true,
   
'HTML_CACHE_TIME'=>10,
   
//'HTML_READ_TYPE'=>1,
);

return 
array_merge( $arrConfigs,require '../Config.php' );
静态定义文件html.php

<?php
/**

 //  The DoYouHaoBaby PHP FrameWork - html
 //  +---------------------------------------------------------------------
 //
 //  “Copyright”
 //  +---------------------------------------------------------------------
 //     | (C) 2010 - 2011 http://doyouhaobaby.net All rights reserved.
 //     | This is not a free software, use is subject to license terms
 //  +---------------------------------------------------------------------
 //
 //  “About This File”
 //  +---------------------------------------------------------------------
 //     | html 静态配置文件
 //  +---------------------------------------------------------------------

*/

!defined('DYHB_PATH') && exit;

return array(

   
'*'=>array('{$_SERVER.REQUEST_URI|md5}'),
);
控制器IndexControl类

<?php
/**

 //  The DoYouHaoBaby PHP FrameWork - html
 //  +---------------------------------------------------------------------
 //
 //  “Copyright”
 //  +---------------------------------------------------------------------
 //     | (C) 2010 - 2011 http://doyouhaobaby.net All rights reserved.
 //     | This is not a free software, use is subject to license terms
 //  +---------------------------------------------------------------------
 //
 //  “About This File”
 //  +---------------------------------------------------------------------
 //     | html Index控制器
 //  +---------------------------------------------------------------------

*/

!defined('DYHB_PATH') && exit;

class 
IndexController extends Controller{

    public function 
index(){
       
       
$this->display();
    }

}