Skip to content

Instantly share code, notes, and snippets.

@belocer
Created July 1, 2019 08:48
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 belocer/bc09f922ebafe5da0c1b6f498f386b87 to your computer and use it in GitHub Desktop.
Save belocer/bc09f922ebafe5da0c1b6f498f386b87 to your computer and use it in GitHub Desktop.
AutoLoad Classes
<?php
spl_autoload_register(function ($ClassName){
$filePath = 'classes/' . $ClassName;
if (file_exists($filePath)) {
require_once $filePath;
}
});
spl_autoload_register(function ($ClassName){
$filePath = 'controller/' . $ClassName;
if (file_exists($filePath)) {
require_once $filePath;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment