diff options
-rw-r--r-- | core/application.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/application.php b/core/application.php index 8d0b8a3..cb2e5b2 100644 --- a/core/application.php +++ b/core/application.php @@ -21,11 +21,15 @@ if(!version_compare(PHP_VERSION, '7.3', '>=')) { define('ROOT', dirname(__DIR__).'/'); #=============================================================================== -# Autoload register for classes +# Register autoloader for classes #=============================================================================== -spl_autoload_register(function($classname) { - $classname = str_replace('\\', '/', $classname); - require "namespace/{$classname}.php"; +spl_autoload_register(function($className) { + $classPath = str_replace('\\', '/', $className); + $classPath = ROOT."core/namespace/{$classPath}.php"; + + if(is_file($classPath)) { + require $classPath; + } }); #=============================================================================== |