All controllers in CI must inherit the super controller to use the CI function:/*** CI Super controller. all controller files must inherit the super CI_Controller */class
All controllers in CI must inherit the super controller to use the CI function:
/*** CI Super controller. all controller files must inherit from the super CI_Controller */class CI_Controller {// defines the static member variable private static $ instance for saving the Singleton; // The constructor public function _ construct () {// implements the singleton. in the first instance, the static variable actually references this instance. Self: $ instance = & $ this; // is_load () is CodeIgniter. record the array of loaded class names in php // All loaded components are given to the super controller foreach (is_loaded () as $ var => $ class) {$ this-> $ var = & load_class ($ class);} // load and initialize the loader component. for details, see loader. php $ this-> load = & load_class ('loader ', 'core'); $ this-> load-> initialize (); log_message ('debug ', "Controller Class Initialized");} // create a method for instantiating an object/* CodeIgniter. the function & get_instance () {return CI_Controller: get_instance ();} in php can be used to obtain this single instance */public static function & get_instance () {return self: $ instance ;}}