Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php
  2. require_once('config.php');
  3.  
  4. function autoload($className)
  5. {
  6. $classNameWithNamespaceArray = explode('\\', $className);
  7. $classFile = array_pop($classNameWithNamespaceArray) . '.php';
  8. foreach (PATHS as $path) {
  9. check_and_include(ROOT . DS . $path . DS . $classFile);
  10. }
  11. }
  12.  
  13. function check_and_include(string $file_path)
  14. {
  15. if (file_exists($file_path)) {
  16. require_once($file_path);
  17. }
  18. return;
  19. }
  20.  
  21. spl_autoload_register('autoload');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement