我一直在做CI几个月,并达到了我想要在CI上创建自己的类库的点。现在,我的问题是,我似乎无法获得CI的实例,以便我利用其本地资源。我已经做到了。初始化自定义类中contstructor内部的Codeigniter实用程序
class MyClass{
protected $instance;
public function __construct()
{
$this->$instance = &get_instance(); <-- this is what i did (theoretically speaking)
}
}
其他的事情我已经试过
class MyClass{
protected $instance = &get_instance(); <-- reports a syntax error on Apatana
public function __construct()
{
}
}
任何人的你在那里谁可以给我如何获得实例更好的主意(初始化它的源代码中的一个点)< - 被说,我希望得到的实例只有一次,使用全在我类
'protected $ instance =&get_instance();'不支持'PHP' – Baba 2013-04-20 10:59:22
那么你如何做到这一点? – lemoncodes 2013-04-20 11:01:15