-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathautoload.php
More file actions
executable file
·29 lines (28 loc) · 824 Bytes
/
autoload.php
File metadata and controls
executable file
·29 lines (28 loc) · 824 Bytes
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
<?php
/**
* @note
* kafka类的autoload文件
*
* @author yangmingchuan
* @date 2015-07-03
*/
spl_autoload_register(function($className)
{
$basePath = dirname(__FILE__) . '/';
$classFile = $basePath . str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php';
if (function_exists('stream_resolve_include_path')) {
$file = stream_resolve_include_path($classFile);
} else {
foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) {
if (file_exists($path . '/' . $classFile)) {
$file = $path . '/' . $classFile;
break;
}
}
}
/* If file is found, store it into the cache, classname <-> file association */
if (($file !== false) && ($file !== null)) {
include $file;
return;
}
});