Теперь работает внутри директорий тоже.

This commit is contained in:
Ivor Barhansky 2023-06-11 14:26:17 +03:00
parent cf2aea847a
commit 72c502d94a

View File

@ -9,7 +9,7 @@ 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'; $rootdir = $_SERVER['DOCUMENT_ROOT'] . '/_incl_data';
# 1 with namespaces # 1 with namespaces
# 2 without # 2 without
$fileName = [ $fileName = [
@ -25,7 +25,7 @@ spl_autoload_register(function (string $className) {
}); });
spl_autoload_register(function (string $classname) { spl_autoload_register(function (string $classname) {
$rootdir = getcwd() . '/_incl_data'; $rootdir = $_SERVER['DOCUMENT_ROOT'] . '/_incl_data';
$classMap = [ $classMap = [
'NewCombats' => $rootdir . '/class/', 'NewCombats' => $rootdir . '/class/',
'Insallah' => $rootdir . '/class/Insallah/', 'Insallah' => $rootdir . '/class/Insallah/',