1<?phpif( !defined(' BasePath '))Exit(' No Direct script access allowed ');2 3 /**4 * CodeIgniter application Controller Class5 */6 classCi_controller {7 8 Private Static $instance;9 Ten /** One * Constructor A */ - Public function__construct () - { the //by self:: $instance implementation of the Singleton, in the first instance, the static variable is the real reference to this instance. - &get_instance () can be used to obtain this single instance. -Self::$instance=&$this; - + //all the components that have been loaded by the current program are given to this super controller. - foreach(Is_loaded () as $var=$class) + { A $this-$var=& Load_class ($class); at } - - //load the loader component for the controller, this component is its good helper, often you will use the form of $this->load->xxx () to load something, - //This load is associated with the presence of the controller when it is constructed. - $this->load =& load_class (' Loader ', ' core '); - in //initializes the loader component, detailing loader.php - $this->load->Initialize (); to +Log_message (' Debug ', ' Controller Class Initialized ')); - } the * Public Static function&get_instance () $ {Panax Notoginseng returnSelf::$instance; - } the}
11) CodeIgniter Source code Analysis of the controller.php