Created
February 23, 2012 23:42
-
-
Save hirak/1895779 to your computer and use it in GitHub Desktop.
シンプルなPSR-0準拠クラスオートローダー ref: http://qiita.com/items/2774
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 | |
//以下、コードの先頭に書いておけば以降require_onceを書かなくてよくなる | |
function simpleClassLoader($classname) { | |
return @include_once str_replace( | |
array('\\', '_'), | |
DIRECTORY_SEPARATOR, | |
$classname | |
) . '.php'; | |
} | |
spl_autoload_register('simpleClassLoader'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment