用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2350|回复: 0
收起左侧

[讨论/交流] 看输出日志 写的流程,请大家指正

[复制链接]
发表于 2012-6-30 17:33:05 | 显示全部楼层 |阅读模式
查看了流程
DEBUG - 2012-06-29 10:33:45 --> Config Class Initialized
DEBUG - 2012-06-29 10:33:45 --> Hooks Class Initialized
DEBUG - 2012-06-29 10:33:45 --> Utf8 Class Initialized
DEBUG - 2012-06-29 10:33:45 --> UTF-8 Support Enabled
DEBUG - 2012-06-29 10:33:45 --> URI Class Initialized
DEBUG - 2012-06-29 10:33:45 --> Router Class Initialized
DEBUG - 2012-06-29 10:33:45 --> Output Class Initialized
DEBUG - 2012-06-29 10:33:45 --> Security Class Initialized
DEBUG - 2012-06-29 10:33:45 --> Input Class Initialized
DEBUG - 2012-06-29 10:33:45 --> Global POST and COOKIE data sanitized
DEBUG - 2012-06-29 10:33:45 --> Language Class Initialized
DEBUG - 2012-06-29 10:33:45 --> Loader Class Initialized
这个是初始化要经历的步骤
上述日志是由于调用了
function log_message($level = 'error', $message, $php_error = FALSE)

1 Index.php
会载入
CodeIgniter.php
- require(BASEPATH.'core/Common.php'); 载入公共函数
- require(APPPATH.'config/constants.php'); 载入文件和目录的模式配置
- get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
若在index中设置$assign_to_config['subclass_prefix'],加载config文件,并替换扩展的前缀
- $BM =& load_class('Benchmark', 'core'); 载入基准测试函数,定义了程序的开始时间
- $EXT =& load_class('Hooks', 'core'); 会同时加载 config,所以在log,config会在hooks前面
- $EXT->_call_hook('pre_system'); 调用hooks中数组名称为pre_system的并执行
- $CFG =& load_class('Config', 'core'); 已经调用过了,所以不会再加载,因此在日志中也没有体现
- if (isset($assign_to_config)) 在index.php中是否有
- $UNI =& load_class('Utf8', 'core'); //初始化,并判断是否支持UTF-8的环境,因此在日志中会有 UTF-8 Support Enabled
- $URI =& load_class('URI', 'core');
- $RTR =& load_class('Router', 'core'); //
- $OUT =& load_class('Output', 'core'); //加载输出函数
- if ($EXT->_call_hook('cache_override') === FALSE) //加载钩子中的
- $SEC =& load_class('Security', 'core');  运行安全函数
- $IN        =& load_class('Input', 'core'); 加载输入函数
- $LANG =& load_class('Lang', 'core');  加载语言包
- require BASEPATH.'core/Controller.php';
- include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'); 加载相应的控制器
- $BM->mark('loading_time:_base_classes_end');
- if ( ! file_exists(APPPATH.'controllers/'.$class.'.php')) 加载404错误文件 $x = explode('/', $RTR->routes['404_override']);
- $EXT->_call_hook('pre_controller'); 钩子加载
- $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start'); 计算加载时间
- $CI = new $class(); 加载函数
- $EXT->_call_hook('post_controller_constructor'); 在构造函数之前
- call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2));  运行函数
- $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end'); 控制器运行完成
- $EXT->_call_hook('post_controller'); 在控制器执行完后 ,运行钩子
- $EXT->_call_hook('display_override') 若没有显示覆盖的钩子
- $OUT->_display(); 运行输出
- $EXT->_call_hook('post_system'); 在输出后,运行钩子post_system
- $CI->db->close(); 关闭数据库连接

本版积分规则