CI加载目录_CI框架

10 篇文章 0 订阅
3 篇文章 0 订阅
CI目录:

      index.php  //define  一些全局路径变量

            require_once BASEPATH.'core/CodeIgniter.php';

            require(BASEPATH.'core/Common.php');  //系统一些公共函数

            require(APPPATH.'config/constants.php');  //define 一些目录使用的函数

            $BM =& load_class('Benchmark', 'core');    //This class enables you to mark points and calculate the time difference
 * between them.  Memory consumption can also be displayed.   程序运行计时器
           $BM->mark('total_execution_time_start');
           $BM->mark('loading_time:_base_classes_start');

          $EXT =& load_class('Hooks', 'core'); //钩子  用户自定义扩展程序

           $EXT->_call_hook('pre_system');  //run 自定义程序

           $CFG =& load_class('Config', 'core');  //载入config(配置类)


          $UNI =& load_class('Utf8', 'core'); //载入UFT8类(编码类)


         $URI =& load_class('URI', 'core'); //载入URI类(路径类)

        $RTR =& load_class('Router', 'core'); //载入Router(路由类)

$RTR->_set_routing(); //载入路由 获得路径中的directory/class/method


        $SEC =& load_class('Security', 'core'); //载入Security(csrf xss )

        $IN =& load_class('Input', 'core');//载入Input类(输入数据安全处理)

        $LANG =& load_class('Lang', 'core'); //载入Lang类(语言类,就是CI框架本身和本身的类使用的语言库)


                 require BASEPATH.'core/Controller.php';//载入控制器

class CI_Controller {

	private static $instance;

	/**
	 * Constructor
	 */
	public function __construct()
	{
		self::$instance =& $this;
		
		// Assign all the class objects that were instantiated by the
		// bootstrap file (CodeIgniter.php) to local class variables
		// so that CI can run as one big super object.
		foreach (is_loaded() as $var => $class)
		{
			$this->$var =& load_class($class);
		}
		

		$this->load =& load_class('Loader', 'core');
		
		
		$this->load->initialize();
		
		log_message('debug', "Controller Class Initialized");
	}

	public static function &get_instance()
	{
		return self::$instance;
	}
}
/*is_loaded()=array(10) {
  ["benchmark"]=>
  string(9) "Benchmark"
  ["hooks"]=>
  string(5) "Hooks"
  ["config"]=>
  string(6) "Config"
  ["utf8"]=>
  string(4) "Utf8"
  ["uri"]=>
  string(3) "URI"
  ["router"]=>
  string(6) "Router"
  ["output"]=>
  string(6) "Output"
  ["security"]=>
  string(8) "Security"
  ["input"]=>
  string(5) "Input"
  ["lang"]=>
  string(4) "Lang"
}

$this->load->initialize();  //載入config/autoload.php
*/
                   include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'); //载入用户控制器  


          $EXT->_call_hook('pre_controller'); 

         $EXT->_call_hook('post_controller_constructor');

         $EXT->_call_hook('post_controller');

         $EXT->_call_hook('post_system');

         $CI->db->close(); //关闭db


挂勾点

以下是一组可用的挂钩点.

  • pre_system
    系统执行的早期调用.仅仅在benchmark 和 hooks 类 加载完毕的时候. 没有执行路由或者其它的过程.
  • pre_controller
    在调用你的任何控制器之前调用.此时所用的基础类,路由选择和安全性检查都已完成.
  • post_controller_constructor
    在你的控制器实例化之后,任何方法调用之前调用.
  • post_controller
    在你的控制器完全运行之后调用.
  • display_override
    覆盖_display()函数, 用来在系统执行末尾向web浏览器发送最终页面.这允许你用自己的方法来显示.注意,你需要通过 $this->CI =& get_instance() 引用 CI 超级对象,然后这样的最终数据可以通过调用 $this->CI->output->get_output() 来获得。
  • cache_override
    可以让你调用自己的函数来取代output类中的_display_cache() 函数.这可以让你使用自己的缓存显示方法
  • post_system
    在最终着色页面发送到浏览器之后,浏览器接收完最终数据的系统执行末尾调用




       
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值