/ coding

CI 加载流程

今天继续CI框架的项目又遇坑,索性就把ci加载过程理了一便:

    index.php
      ->core/CodeIgniter.php
         ->require_once(APPPATH.'config/constants.php');//Load the framework constants
         ->require_once(BASEPATH.'core/Common.php');//Load the global functions
         -?>require_once(APPPATH.'vendor/autoload.php')
         ->load_class('Benchmark', 'core');
         ->load_class('Hooks', 'core');//Instantiate the hooks class
             ->include(APPPATH.'config/hooks.php');
         ->load_class('Config', 'core');//Instantiate the config class
         ->require_once(BASEPATH.'core/compat/mbstring.php');
         ->require_once(BASEPATH.'core/compat/hash.php');
         ->require_once(BASEPATH.'core/compat/password.php');
         ->require_once(BASEPATH.'core/compat/standard.php');
         ->load_class('Utf8', 'core');Instantiate the UTF-8 class
         ->& load_class('URI', 'core');//Instantiate the URI class
         ->load_class('Router', 'core', isset($routing) ? $routing : NULL);// Instantiate the routing class and set the routing
         ->load_class('Output', 'core');//Instantiate the output class
         ->load_class('Security', 'core');//Load the security class for xss and csrf support
         ->load_class('Input', 'core');//Load the Input class and sanitize globals
         ->load_class('Lang', 'core');//Load the Language class
         ->require_once BASEPATH.'core/Controller.php';//Load the app controller and local controller
             ->load_class('Loader', 'core');
         -?>require_once APPPATH.'core/'.$CFG-    >config['subclass_prefix'].'Controller.php';
         -?>require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');
         -?>require_once(APPPATH.'controllers/'.$RTR->directory.$error_class.'.php');
         -?>require_once(APPPATH.'controllers/'.$error_class.'.php');