mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进Loader类的autoload方法
This commit is contained in:
@@ -27,14 +27,8 @@ class Loader {
|
|||||||
if(isset(self::$map[$class])) {
|
if(isset(self::$map[$class])) {
|
||||||
include self::$map[$class];
|
include self::$map[$class];
|
||||||
}else{ // 命名空间自动加载
|
}else{ // 命名空间自动加载
|
||||||
$find = false;
|
$name = strstr($class,'\\',true);
|
||||||
foreach (self::$namespace as $name=>$path){
|
$path = isset(self::$namespace[$name])?dirname(self::$namespace[$name]).'/':APP_PATH;
|
||||||
if(0 === stripos($class,$name)) {
|
|
||||||
$find = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$path = $find?dirname($path).'/':APP_PATH;
|
|
||||||
$filename = $path.str_replace('\\','/',$class).EXT;
|
$filename = $path.str_replace('\\','/',$class).EXT;
|
||||||
if(is_file($filename)) {
|
if(is_file($filename)) {
|
||||||
// Win环境下面严格区分大小写
|
// Win环境下面严格区分大小写
|
||||||
|
|||||||
Reference in New Issue
Block a user