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