Welcome Guest, Not a member yet? Register   Sign In
Does CodeIgniter Automatically instantiate all classes in a file??
#4

(07-06-2015, 09:38 AM)mwhitney Wrote: It is recommended that each file only contain one class, and that the name of the file and class match. However, if you ignore that and add any additional classes to the file, they will be included, but not instantiated. The loader doesn't instantiate classes it isn't told to load, even if they are included in the same file as a class it is told to load.

Additionally, a library's class and file name should start with a capital letter (the loader applies ucfirst() to the first parameter passed to the library() method, so you can call $this->load->library('test'), but the file should be named Test.php, and it should contain a class named Test). An all-lowercase file name may work in development environments that don't have case-sensitive file systems, but most server environments do use case-sensitive file systems. CI2 might work with either name for a library, but CI3 won't.

Alright got it! Thanks a lot mwhitney
Reply


Messages In This Thread
RE: Does CodeIgniter Automatically instantiate all classes in a file?? - by eldan88 - 07-18-2015, 05:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB