Reputation: 1241
I started using Codeigniter few days ago and I am wondering how does it work?
I mean the whole loading classes, ex:
$this->load->model('model_class_file');
and then using it as
$this->model_class_file->method();
How is it called and what else should I know about php?
Upvotes: 0
Views: 40
Reputation: 175098
Simple $this->load
is a property which holds a Loader
object, with a method called model()
to load model files. The model is then saved onto a private property as an array element.
When accessing $this->whatever_name_you_put
, PHP will magically search for that index in the private property, and make it available.
Upvotes: 1