Load Libraries |
**New to CI**
I have read the documentation and the Practice CodeIgniter 3. I can not seem to figure out how to load my own library in 'application/libraries/TestLib'. Tried : PHP Code: $this->load->library('TestLib'); PHP Code: $testLib = new App\Libraries\TestLib(); I've been looking all over but haven't seemed to figure out why it is not loading. CodeIgniter-3.1.6
CI will look for the UCfirst name of a libarary, namely "Testlib" in your case.
On Windows, "TestLib" would be found, but not on Linux, because of case sensitivity. I recommend changing the name to conform to the style guide... https://www.codeigniter.com/user_guide/g...hod-naming
Ok, so I have refactored the filename to 'Test_lib.php' and class name to Test_lib.
Now what, It's still not found...
I thought I did, but being new to CI, I must admit I may not have it done right. Do you have a resource to point to?
If you set up namespacing you need to use the php use keyword at the top of your class. $this->load will not work.
|
Welcome Guest, Not a member yet? Register Sign In |