سلام وقتتون بخیر
موقع ران کردن فایل سیتی اندپوینت این ارور مدام ایجاد میشود :
Uncaught Exception: Class file not found: C:\xampp\htdocs\iran\Iran\App\Utilities\App\Services\CityService.php in C:\xampp\htdocs\iran\Iran\App\Utilities\loader.php:18 Stack trace: #0 C:\xampp\htdocs\iran\Iran\api\v1\cities\index.php(10): {closure}('App\\Services\\Ci...') #1 {main} thrown in C:\xampp\htdocs\iran\Iran\App\Utilities\loader.php on line 18
کدبلاکهای اتولودر :
spl_autoload_register(function ($class) {
// Convert namespace separators to directory separators
$classPath = str_replace("\\", DIRECTORY_SEPARATOR, $class);
// Construct the full file path
$filePath = __DIR__ . DIRECTORY_SEPARATOR . $classPath . ".php";
// Check if the file exists and include it
if (file_exists($filePath)) {
include $filePath;
} else {
throw new Exception("Class file not found: " . $filePath);
}
});
کدبلاکهای فایل سیتی اندپوینت:
include_once "C:\\xampp\\htdocs\\iran\\Iran\\App\\Utilities\\loader.php";
use \App\Services\CityService;
use \App\Utilities\Response;
$cityService = new CityService();
$request_method = $_SERVER['REQUEST_METHOD'];