I need to load my models without $this->load->model
. I have to load it like this:
$modelName = new ModelName();//from a controller
class ModelName{
public function __construct(){
$CI =&ge开发者_运维问答t_instance();
var_dump($CI);//null
}
}
It is working fine, but the $CI =&get_instance();
is actually null. Any idea why?
Edit 1
If I am trying the get_instance from a regular Controler, it is working (also from the helper). I am loading the model with require_onceTry extending CI_Model.
class ModelName extends CI_Model {
public function __construct(){
$CI =&get_instance();
var_dump($CI);
}
}
精彩评论