-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
35 lines (25 loc) · 791 Bytes
/
Copy pathindex.php
File metadata and controls
35 lines (25 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
error_log("Request URI: " . $_SERVER['REQUEST_URI']);
const BASE_PATH = __DIR__ . '/';
require 'core/helpers.php';
require 'core/Router.php';
require_once 'vendor/autoload.php';
require_once 'bootstrap.php';
spl_autoload_register(function ($class) {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
$path = basePath("{$class}.php");
if (file_exists($path)) {
require $path;
} else {
die('Error: File not found for class ' . $class . ' at ' . $path);
}
});
$router = core\Router::getRouter();
require BASE_PATH . "routes/web.php";
$method = $_SERVER['REQUEST_METHOD'];
$uri = $_SERVER['REQUEST_URI'];
$router->route($method, $uri);
exit();