From 6c1f6b15717a4875620f49b4005621a60fd83f61 Mon Sep 17 00:00:00 2001 From: bruno Date: Tue, 6 Feb 2024 16:28:36 +0100 Subject: [PATCH] test --- lib/endpoint.php | 4 ++-- lib/router.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/endpoint.php b/lib/endpoint.php index fa52aff..15bfc63 100644 --- a/lib/endpoint.php +++ b/lib/endpoint.php @@ -18,7 +18,7 @@ function getEndpoint($endpoint_name): string global $routerRequest; if(!$endpoint_name){ - $endpoint_name = $routerRequest["page_name"]; + $endpoint_name = $routerRequest["site_name"]; } $endpoint_file = $routerConfig["endpoint_dir"] . $endpoint_name . ".php"; @@ -27,7 +27,7 @@ function getEndpoint($endpoint_name): string $output = runEndpoint($endpoint_file); } else{ - $output["error"] = "Not found"; + $output["Error"] = "Not found"; http_response_code(404); } diff --git a/lib/router.php b/lib/router.php index 0b704be..21485a4 100644 --- a/lib/router.php +++ b/lib/router.php @@ -11,6 +11,7 @@ function initRouter(): array $request_uri = explode("/", $_SERVER["QUERY_STRING"]); $request_uri = array_slice($request_uri, -3, 3); + print_r($request_uri); $routerRequest["site_name"] = basename($request_uri[1]); $routerRequest["page_name"] = basename($request_uri[2]);