CodeIgniter-3.0.0\system\core\Controller.php 的文件中
本帖最后由 a_酋长 于 2015-8-10 18:00 编辑在CodeIgniter-3.0.0\system\core\Controller.php文件中
class CI_Controller {
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.
foreach (is_loaded() as $var => $class)
{
$this->$var =& load_class($class);
}
// $this->load =& load_class('Loader', 'core');
// $this->load->initialize();
// $load =& load_class('Loader', 'core');
// $load->initialize();//
// var_dump($this->load);
log_message('info', 'Controller Class Initialized');
}
1,蓝色的$this->load 是怎么理解呢?不知道 对load是怎么定义 是类class CI_Controller 的属性?还是方法?
2,那把 $this->load ($this->load =& load_class('Loader', 'core');) 换写成为 $load ($load =& load_class('Loader', 'core');)为什么不可以呀?求指导!!!谢谢!!!!
本帖最后由 greedefoxes 于 2015-8-11 15:23 编辑
我的理解是:$this->load 是一个别名,相当于在引用load_class(); $this指 实例化后的具体对象,load相当于该对象的一个方法。 不知道对不对。 $this->load 是属性
有 $this 和 没 $this 差别很大的。
页:
[1]