-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoload.php
More file actions
31 lines (29 loc) · 1.1 KB
/
Copy pathautoload.php
File metadata and controls
31 lines (29 loc) · 1.1 KB
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
<?php
// +----------------------------------------------------------------------
// | multi-process
// +----------------------------------------------------------------------
// | Copyright (c) 2022
// +----------------------------------------------------------------------
// | Licensed MIT
// +----------------------------------------------------------------------
// | Author: js
// +----------------------------------------------------------------------
// | Date: 2022-07-09
// +----------------------------------------------------------------------
// | Time: 下午 03:22
// +----------------------------------------------------------------------
namespace phpth\process;
spl_autoload_register(function ($class_name) {
if (stripos($class_name, 'phpth\process') === false) {
return false;
}
$class_name = str_ireplace('phpth\process', '', $class_name);
$class_name = str_replace('\\', '/', ltrim($class_name, '\\'));
$path = realpath(__DIR__);
$file = $path . "/{$class_name}.php";
if (file_exists($file)) {
return require $file;
} else {
return false;
}
});