Advertisement
jesse_klaver

autoloader.php

May 29th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. <?php
  2.     $searchPaths = Array();
  3.     array_push($searchPaths, "");
  4.     array_push($searchPaths, "managers/");
  5.     array_push($searchPaths, "models/");
  6.  
  7.     require_once 'database.php';
  8.  
  9.     function __autoload($aClassName){
  10.         global $searchPaths;
  11.         foreach($searchPaths as $paths) {
  12.             $fileName = $paths . $aClassName . ".php";
  13.             if(file_exists($fileName)) {
  14.                 require_once $fileName;
  15.                 return;
  16.             }
  17.         }
  18.     }
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement