Created
June 2, 2015 14:11
-
-
Save morningtoast/afe92a4c276e95ccfeb4 to your computer and use it in GitHub Desktop.
CodeIgniter autoload classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| |-------------------------------------------------------------------------- | |
| | Autoload Custom Controllers | |
| |-------------------------------------------------------------------------- | |
| | http://stackoverflow.com/questions/21351808/codeigniter-extending-controller-controller-not-found | |
| | | |
| | Add this to the bottom of /config/config.php | |
| | | |
| | As long as your library is prefixed with "MY_" and lives in the /core/ folder, this will | |
| | autoload that library when you extend without having to otherwise include it. | |
| | | |
| | | |
| */ | |
| function __autoload($class) { | |
| if (substr($class,0,3) !== 'CI_') { | |
| if (file_exists($file = APPPATH.'core/'.$class.".php")) { | |
| include $file; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment