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

首頁 > 學院 > 開發(fā)設計 > 正文

[CI]CodeIgniter系統(tǒng)流程

2019-11-15 01:42:30
字體:
來源:轉載
供稿:網友
[CI]CodeIgniter系統(tǒng)流程

------------------------------------------------------------------------------------------------------

進入框架入口文件index.php =>

定義應用的當前環(huán)境(用于設置錯誤模式):define('ENVIRONMENT', 'development');

設置系統(tǒng)文件目錄名:$system_path = 'system';

設置應用文件目錄名:$application_folder = 'application';  //可自定義

定義當前文件名常量:define('SELF', pathinfo(__FILE__, PATHINFO_BASEPATH));

定義PHP文件后綴常量:define('EXT', '.php');  //這個全局常量不推薦使用

定義系統(tǒng)目錄路徑常量:define('BASEPATH', str_replace('//', '/', $system_path));

定義前端控制器文件路徑常量:define('FCPATH', str_replace(SELF, '', __FILE__));

定義系統(tǒng)目錄名常量:define('SYSDIR', trim(strchr(trim(BASEPATH, '/'), '/'), '/'));

定義應用目錄路徑常量:define('APPPATH', BASEPATH.$application_folder.'/');

加載引導文件:require_once BASEPATH.'core/CodeIgniter.php';

---------------------------------@黑眼詩人 <www.farwish.com>---------------------------------

進入系統(tǒng)初始化文件CodeIgniter.php =>

define('CI_VERSION', '2.2.0');

define('CI_CORE', FALSE);

require(BASEPATH.'core/Common.php');   //引入公共函數庫文件,包含load_class()等函數

require(APPPATH.'config/'.ENVIRONMENT.'/constants.php'); //引入框架常量文件,文件和目錄模式 & 文件流模式

set_error_handler('_exception_handler');   //定義一個自定義錯誤處理程序以便記錄PHP錯誤

if ( ! is_php('5.3')){  @set_magic_quotes_runtime(0); // Kill magic quotes}

if (isset($assign_to_config['subclass_

//設置子類前綴{  get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));}

if (function_exists("set_time_limit") == TRUE AND @ini_get("safe_mode") == 0)

//設置一個自由的腳本執(zhí)行時間限制{  @set_time_limit(300);}

$BM =& load_class('Benchmark', 'core');

//實例化Benchmark基準類,此類使你可以標記點并計算它們之間時間差,內存消耗也可以顯示

$BM->mark('total_execution_time_start');

//基準標記,總執(zhí)行時間開始:$this->marker['total_execution_time_start'] = microtime();$BM->mark('loading_time:_base_classes_start');

//基準標記,加載的時間:$this->marker['loading_time:_base_classes_start'] = microtime();

$EXT =& load_class('Hooks', 'core');    //實例化Hooks鉤子類,提供一種不堆砌來擴展基礎系統(tǒng)的機制

$EXT->_call_hook('pre_system');     //調用指定鉤子pre_system

$CFG =& load_class('Config', 'core');   //實例化Config配置類,包含管理配置文件的方法

if (isset($assign_to_config)){  $CFG->_assign_to_config($assign_to_config);

  //調用Config.php中_assign_to_config方法,保證配置項通過變量被分配 和 重寫}

$UNI =& load_class('Utf8', 'core');    //實例化Utf8類,對UTF-8環(huán)境提供支持

$URI =& load_class('URI', 'core');    //實例化URI類,解析URI 和 決定路由

$RTR =& load_class('Router', 'core'); //實例化Router路由類,解析URI 和 決定路由

$RTR->_set_routing();        //這個函數確定什么應該是基于URI請求,以及路由配置文件中設置的路由

if (isset($routing)){  $RTR->_set_overrides($routing); //設置控制器覆蓋}

$OUT =& load_class('Output', 'core');  //實例化Output輸出類,負責發(fā)送最終的輸出到瀏覽器

if ($EXT->_call_hook('cache_override') === FALSE){  if ($OUT->_display_cache($CFG, $URI) == TRUE)  {    exit;               //檢測是否有緩存文件,如果有,直接退出當前腳本  }}

$SEC =& load_class('Security', 'core');  //實例化Security安全類

$IN =& load_class('Input', 'core');    //實例化Input輸入類,為了安全對全局輸入數據預處理  

$LANG =& load_class('Lang', 'core');  //實例化Lang語言類

require BASEPATH.'core/Controller.php';, //引入 基礎控制器類

function &get_instance(){  return CI_Controller::get_instance(); //返回靜態(tài)變量$instance}

if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php')){  require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';

  //引入自定義擴展 基礎控制器類}

if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php')){  show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');}

include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php');

//加載本地控制器

$BM->mark('loading_time:_base_classes_end');

//基準標記,加載的時間結束:$this->marker['loading_time:_base_classes_end'] = microtime();

安全檢查

$EXT->_call_hook('pre_controller');  //調用"pre_controller" hook

$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start'); //基準標記,控制器執(zhí)行時間標記點

$CI = new $class();  //實例化請求控制器

$EXT->_call_hook('post_controller_constructor'); //調用"post_controller_constructor" hook

調用請求的方法

$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end'); //基準標記,控制器執(zhí)行時間結束標記點

$EXT->_call_hook('post_controller');  //調用"post_controller" hook

if ($EXT->_call_hook('display_override') === FALSE){  $OUT->_display();      //發(fā)送最后的渲染輸出到瀏覽器}

$EXT->_call_hook('post_system');  //調用"post_system" hook

if (class_exists('CI_DB') AND isset($CI->db)){  $CI->db->close();        //關閉數據庫連接}

-------------------------------------------------------------------------------------------------


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 鄂托克旗| 合江县| 阿拉善左旗| 伊春市| 全南县| 永丰县| 教育| 兴宁市| 霍州市| 永胜县| 申扎县| 昌吉市| 泗洪县| 苍南县| 长乐市| 濉溪县| 札达县| 武冈市| 和龙市| 长垣县| 洞头县| 泽普县| 新野县| 芜湖县| 海阳市| 旺苍县| 晋中市| 太和县| 金塔县| 五台县| 乌兰察布市| 南雄市| 红原县| 寿光市| 台东县| 镇康县| 彭山县| 南宁市| 太保市| 清水县| 泾源县|