这个不错的
为什么 要这么用 $this 呐?
$this->CI = & get _instance();
$this->CI->router;
....
既然是自己的超级类,为什么不覆写 php __get() 方法呐?
我是这么写的(参考自 CI_model类):class MyClass
{
public function __construct()
{
$this->load->helper('url'); // 在整个类中都可以用 ci 的$this了。
}
public function __get($key)
{
$CI = & get_instance();
return $CI->$key;
}
}这样不就可以少写 几个字母了,而且从此类延伸出来的都可以直接用 $this。
正需要这个 等用到这块的时候再回头仔细看下
页:
1
[2]