Skip to content

Instantly share code, notes, and snippets.

@joubertredrat
Created October 6, 2014 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joubertredrat/dac985c89f13bdc18adf to your computer and use it in GitHub Desktop.
Save joubertredrat/dac985c89f13bdc18adf to your computer and use it in GitHub Desktop.
Exemplo autoload
<?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