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]);