<?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
*/
// ------------------------------------------------------------------------
/**
* CodeIgniter Application Controller Class
* CI 应用控制器类
*
* 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; //私有的静态的变量,instance
/**
* Constructor
*/
public function __construct()
{
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.
// 将所有的类实例化的对象
// 自举文件(CodeIgniter.php)局部类变量
// 所以,CI可以运行一个超级大对象。
//is_loaded需要加载的一些类文件
foreach (is_loaded() as $var => $class)
{
//然后对每个类进行加载,放入到自己的一个成员中,
//$this->className能运行起来的原因
$this->$var =& load_class($class);
}
//加载Loader类 /core/Loader
$this->load =& load_class('Loader', 'core');
//初始化装载机 initialize() load还没有看源码
$this->load->initialize();
log_message('debug', "Controller Class Initialized 控制器类初始化");
}
//这里有点像那个单线模式,也就是一个类的对象在整个运行过程中只有一个实例
public static function &get_instance()
{
return self::$instance;
/*if(empty(self::$instance))
{
self::$instance = new CI_Controller();
}*/
}
}
// END Controller class
/* End of file Controller.php */
/* Location: ./system/core/Controller.php */