-
Notifications
You must be signed in to change notification settings - Fork 6
/
Autoloader.php
41 lines (39 loc) · 1.1 KB
/
Autoloader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/*
* @Description:
* @Autor: BuWenGuiQi_
* @Date: 2020-08-08 21:19:22
* @LastEditTime: 2020-10-02 16:38:01
*/
class NinesTaoKeAutoloader
{
/**
* @description: 类库自动加载,写死路径,确保不加载其他文件。
* @author: BuWenGuiQi_
* @param {type}
* @return {type}
*/
public static function autoload($class)
{
$name = $class;
if (false !== strpos($name, '\\')) {
$name = strstr($class, '\\', true);
}
$filename = NINES_TAOKE_PATH . "/includes/top/" . $name . ".php";
if (is_file($filename)) {
include $filename;
return;
}
$filename = NINES_TAOKE_PATH . "/includes/top/request/" . $name . ".php";
if (is_file($filename)) {
include $filename;
return;
}
$filename = NINES_TAOKE_PATH . "/includes/" . $name . ".php";
if (is_file($filename)) {
include $filename;
return;
}
}
}
spl_autoload_register('NinesTaoKeAutoloader::autoload');