Не грузило классы из глубоких вложенных папок.
This commit is contained in:
parent
f92aa003ac
commit
bdda3d24a0
@ -9,11 +9,12 @@ require_once 'mysql_override.php';
|
||||
require_once 'class/Insallah/Config.php';
|
||||
|
||||
spl_autoload_register(function (string $className) {
|
||||
$rootdir = getcwd() . '/_incl_data';
|
||||
# 1 with namespaces
|
||||
# 2 without
|
||||
$fileName = [
|
||||
__DIR__ . '/class/' . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'),
|
||||
__DIR__ . '/class/' . $className . '.php'
|
||||
$rootdir . '/class/' . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'),
|
||||
$rootdir . '/class/' . $className . '.php'
|
||||
];
|
||||
foreach ($fileName as $file) {
|
||||
if (file_exists($file)) {
|
||||
@ -24,10 +25,11 @@ spl_autoload_register(function (string $className) {
|
||||
});
|
||||
|
||||
spl_autoload_register(function (string $classname) {
|
||||
$rootdir = getcwd() . '/_incl_data';
|
||||
$classMap = [
|
||||
'NewCombats' => __DIR__ . '/class/',
|
||||
'Insallah' => __DIR__ . '/class/Insallah/',
|
||||
'DarksLight2' => __DIR__ . '/class/DarksLight2/',
|
||||
'NewCombats' => $rootdir . '/class/',
|
||||
'Insallah' => $rootdir . '/class/Insallah/',
|
||||
'DarksLight2' => $rootdir . '/class/DarksLight2/',
|
||||
];
|
||||
$parts = explode('\\', $classname);
|
||||
$namespace = array_shift($parts);
|
||||
|
Loading…
Reference in New Issue
Block a user