CI framework source code reading --------- Controller. php

Source: Internet
Author: User

[Php] <? Php if (! Defined ('basepath') exit ('no direct script access allowed '); /*** CodeIgniter ** An open source application development framework for PHP 5.1.6 or newer ** @ package CodeIgniter * @ author ExpressionEngine Dev Team * @ copyright Copyright (c) 2008-2011, ellisLab, Inc. * @ license http://codeigniter.com/user_guide/license.html * @ link http://codeigniter.com * @ since Version 1.0 * @ filesource *// /Register/*** CodeIgniter Application Controller Class * Application Controller class ** This class object is the super Class that every library in * CodeIgniter will be assigned. * ** @ package CodeIgniter * @ subpackage Libraries * @ category Libraries * @ author ExpressionEngine Dev Team * @ link http://codeigniter.com/user_guide/general/controller S.html */class CI_Controller {private static $ instance;/*** Constructor */public function _ construct () {// use self: $ instance to implement Singleton, in the first instance, this static variable actually references this instance. // You can use & get_instance (); to obtain this single instance. The advantage of this Singleton mode is that the singleton class does not repeatedly occupy memory and system resources, but makes other parts of the application better use these resources. 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. // allocate it to the boot file (CodeIgniter. php) to $ this // so that CI can run a super object. In fact, it means that // all the components already loaded by the program are managed by the super controller. Foreach (is_loaded () as $ var => $ class) {$ this-> $ var = & load_class ($ class);} // load the Loader component to the super controller, this component is a good helper. // you often use $ this-> load-> xxx () to load something, // This load occurs when the controller is constructed. $ This-> load = & load_class ('loader ', 'core'); // initialize the Loader component. php $ this-> load-> initialize (); www.2cto.com log_message ('debug', "Controller Class Initialized");} public static function & get_instance () {return self :: $ instance ;}// END Controller class/* End of file Controller. php * // * Location :. /system/core/Controller. php */

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.