Possible Duplicate:
get_instance() in Codeigniter: Why assign it to a variable?
I have a controller, and it have lots of functions, I would like to separate them into different cmd object. But in controller, I can do the $this
magic, for example, I can call something like this:
$this->form_validation->run('myAction');
But when I move this code to an object, which is not a controller, so, I called the function like this:
$CI =& get_instance();
$CI->form_validation->run('myAction');
I realize that they can run, and the result is exactly what I want. But, my question is, is these two operation or codes have any different? What is the get_instance()
black magic inside? Did the controller's $this
refer to the same get_instance()
? Thanks.