Class instantiation in codeigniter |
And also understand that a call to
PHP Code: $this->load->library('lib_name'); // or load->model('lib_name'); The instance created is added to the controller and is accessed using PHP Code: $this->lib_name->some_method(); In a case where the controller is not in scope a reference to can be obtained using get_instance() eg. PHP Code: $CIĀ =& get_instance(); The Utilizing CodeIgniter Resources within Your Library section of the documentation explains this very well. It may be useful to know that classes instantiated using the loader ($this->load->...) are singletons. |
Messages In This Thread |
Class instantiation in codeigniter - by Santi - 03-13-2018, 03:42 AM
RE: Class instantiation in codeigniter - by dave friend - 03-13-2018, 04:15 PM
RE: Class instantiation in codeigniter - by ciadmin - 03-13-2018, 06:03 PM
RE: Class instantiation in codeigniter - by dave friend - 03-16-2018, 07:10 AM
|