Skip to content

Commit 24c8ad1

Browse files
committed
fix autoloader bug
1 parent 1fb3108 commit 24c8ad1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

autoload.php

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
<?php
22

3-
$path = __DIR__ . DIRECTORY_SEPARATOR . 'src';
4-
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
3+
function classLoader($class)
4+
{
5+
$path = str_replace('\\', DIRECTORY_SEPARATOR, $class);
6+
$file = __DIR__ . '/src/' . $path . '.php';
57

6-
spl_autoload_extensions('.php');
7-
spl_autoload_register();
8+
if (file_exists($file)) {
9+
require_once $file;
10+
}
11+
}
12+
spl_autoload_register('classLoader');
813

9-
require_once 'src/Qiniu/functions.php';
14+
require_once __DIR__ . '/src/Qiniu/functions.php';

0 commit comments

Comments
 (0)