autoload.php 606 B

123456789101112131415161718192021222324252627
  1. <?php
  2. class Autoload {
  3. static public function load() {
  4. // since we already know the directories, loop in an array to include them upon initialization
  5. $paths = array(
  6. 'classes',
  7. 'controller',
  8. 'model',
  9. 'view'
  10. );
  11. // include all of the subdirectories
  12. foreach($paths as $path) {
  13. // make sure the file exists before inclusion
  14. if(file_exists($path . DIRECTORY_SEPARATOR . 'logparser.php')) {
  15. require_once($path . DIRECTORY_SEPARATOR . 'logparser.php');
  16. }
  17. }
  18. }
  19. }
  20. spl_autoload_register('Autoload::load');
  21. $logparse = new Controller;