Created
June 18, 2014 13:30
-
-
Save Bolinha1/ea21a4fe9f5cf41ff6ab to your computer and use it in GitHub Desktop.
autoload
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
| <?php | |
| $whereAmI = dirname(realpath(__FILE__)). DIRECTORY_SEPARATOR; | |
| set_include_path( | |
| implode( | |
| PATH_SEPARATOR, | |
| // Retorna o array sem dados duplicados | |
| array_unique( | |
| array_merge( | |
| array( | |
| $whereAmI . 'app', | |
| ), | |
| explode(PATH_SEPARATOR, get_include_path()) | |
| ) | |
| ) | |
| ) | |
| ); | |
| spl_autoload_register( | |
| function ($qname) | |
| { | |
| $qname2path = stream_resolve_include_path( | |
| str_replace('\\', DIRECTORY_SEPARATOR, $qname) . '.php'); | |
| if ($qname2path !== false) { | |
| require $qname2path; | |
| } | |
| } | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment