// sync up the objects since PHP4 was working from a copy foreach(array_keys(get_object_vars($this))as$attribute) { if(is_object($this->$attribute)) { $this->load->$attribute=&$this->$attribute; } } }
复制代码
在Base4.php 中,有这么一段代码
PHP复制代码
function CI_Base() { // This allows syntax like $this->load->foo() to work
parent::CI_Loader(); $this->load=&$this;
// This allows resources used within controller constructors to work global$OBJ; $OBJ=$this->load;// Do NOT use a reference. }
复制代码
所以小弟理解为:$this->load->$attribute =& $this->$attribute;中的 $this->load=& $this;是否是这样呢?
如果是这样的话,// sync up the objects since PHP4 was working from a copy 这个是为何啊?