From 8d78d292036f5a1a95129fb3adb4b2d6d889f8cc Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Tue, 18 Feb 2020 21:51:18 +0100 Subject: Populate $_GET from request url --- src/Main.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Main.php') diff --git a/src/Main.php b/src/Main.php index c82a334..21c7a95 100644 --- a/src/Main.php +++ b/src/Main.php @@ -29,10 +29,19 @@ class Main implements Entrypoint $r->addRoute(["GET"], "/attachments/{id}", AttachmentHandler::class); } + private static function populateGET(): void + { + $parts = explode("?", $_SERVER["REQUEST_URI"]); + if (isset($parts[1])) + parse_str($parts[1], $_GET); + } + public function run(Env $env) { $disp = simpleDispatcher(Closure::fromCallable([self::class, "buildRoutes"])); + self::populateGET(); + $uri = preg_replace('/\?.*$/', "", $_SERVER["REQUEST_URI"]); $result = $disp->dispatch($_SERVER["REQUEST_METHOD"], $uri); switch ($result[0]) { -- cgit v1.2.3-70-g09d2