![]() |
Is Codeigniter case sensitive? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Is Codeigniter case sensitive? (/showthread.php?tid=53662) |
Is Codeigniter case sensitive? - El Forum - 08-02-2012 [eluser]Unknown[/eluser] Is Codeigniter case sensitive? For example I load a library: this->load->library("TEST") with the library name all capitals and then, can I use this->test->dummy with the "test" all low cases? Is Codeigniter case sensitive? - El Forum - 08-02-2012 [eluser]CroNiX[/eluser] Look at the loader class. It's not consistent. Some will search for the name as is and if it doesn't find it it checks to see if a lower-cased version exists and loads that if it does. Personally, I write filenames that I create in all lower-case, except when extending a core class with MY_ I define classes with upper-case first letter (class Some_class extends CI_Controller) When using the loader, I always use lower-case ($this->load->library('test')) When referencing something that has been loaded, I always use lower-case ($this->test->some_method()) And never have any problems, regardless of operating system. Is Codeigniter case sensitive? - El Forum - 08-02-2012 [eluser]Unknown[/eluser] Thanks for your quick reply. Actually I am looking at somebody's PHP code which is using Codeigniter, and I find he uses this->load->library("Test") and latter on he uses this->test->dummy to call the "Test" library. I just want to confirm if the "Test" loaded library is the same as the called "test". Thanks again. Is Codeigniter case sensitive? - El Forum - 08-02-2012 [eluser]PhilTem[/eluser] If you took a closer look at the CI core (mainly the loader-class), you will find this line of code Code: // Set the variable name we will assign the class to which implies that everything in CI is accessed by $this->lowered_class_name and nothing else. Following the naming conventions for libraries, controllers, and models would also never make a Code: $this->load->library('UPPERCASE_Library'); possible, since it should be avoided using the CI naming convention (cannot find the link at the moment) |