Last active
March 18, 2016 10:12
-
-
Save prinsss/d1af9fefbcbd89996273 to your computer and use it in GitHub Desktop.
Autoload PHP namespace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function __autoload($classname) { | |
$dir = dirname(__FILE__); | |
$include_dir = $dir.DIRECTORY_SEPARATOR."includes".DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR; | |
$filename = $include_dir.str_replace('\\', DIRECTORY_SEPARATOR, $classname) . '.class.php'; | |
require_once($filename); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment