/**
* 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
*/
//--------------------------------------------- --------------------------
/**
* CodeIgniter Application Controller Class
* 应用程序控制器类
*
* This class object is the super class that every library in
* CodeIgniter will be assigned to.
*
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/general/controllers.html
*/
class CI_Controller {
private static $instance;
/**
* Constructor
*/
public function __construct()
{
// Singletonization is achieved through self::$instance. In the first instance, this static variable essentially refers to this instance.
// This single instance can be obtained through &get_instance(); in the future. What constitutes such a singleton pattern
// The advantage is that the singleton class does not repeatedly occupy memory and system resources but allows other parts of the application to 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.
// Assign the class object instantiated in the boot file (CodeIgniter.php) to $this
// This way CI can run a super object. Actually it means
// Give all components that have been loaded by the current program to this super controller.
foreach (is_loaded() as $var => $class)
{
$this->$var =& load_class($class);
} }
// Load the Loader component to the super controller. This component is its good assistant,
// Many times you will often use the form of $this->load->xxx() to load something,
// This load exists when the controller is constructed.
$this->load =& load_class('Loader', 'core');
// Initialize the Loader component, detailed Loader.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 */
http://www.bkjia.com/PHPjc/477662.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/477662.htmlTechArticle[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 * * @packag...