Created
May 27, 2014 16:27
-
-
Save rahilwazir/d94190cb231c7a0b0214 to your computer and use it in GitHub Desktop.
Autoloader PHP Classes with Namespace
This file contains hidden or 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
namespace SearchBlox; | |
function spl_autoloader($class) | |
{ | |
$file = RW_DIR . 'classes/' . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php'; | |
if (file_exists($file)) { | |
include_once $file; | |
} | |
} | |
spl_autoload_register(__NAMESPACE__ . '\spl_autoloader'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment