Created
October 6, 2014 12:01
-
-
Save joubertredrat/dac985c89f13bdc18adf to your computer and use it in GitHub Desktop.
Exemplo autoload
This file contains 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 | |
function __autoload($classe) | |
{ | |
if(file_exists(APP_PATH.'/core/classes'.$classe.'.php')) | |
{ | |
require(APP_PATH.'/core/classes'.$classe.'.php'); | |
add_log_event(SUCCESS, 'Classe '.$classe.' instanciada com sucesso pelo core'); | |
} | |
else if(file_exists(APP_PATH.'/libs/'.$classe.'.php')) | |
{ | |
require(APP_PATH.'/libs/'.$classe.'.php'); | |
add_log_event(SUCCESS, 'Classe '.$classe.' instanciada com sucesso pela pasta de libs'); | |
} | |
else | |
{ | |
add_log_event(ERROR, 'Classe '.$classe.' não tem arquivo correspondente no core ou libs'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment