diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2020-02-18 21:51:18 +0100 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2020-02-18 21:51:18 +0100 |
commit | 8d78d292036f5a1a95129fb3adb4b2d6d889f8cc (patch) | |
tree | e1ceddb6a8a51206724b7265fa38b6ba49dad295 /src/Main.php | |
parent | 4459d411e6cb923ea26a39649011b9bd006cdc33 (diff) | |
download | micropoly-8d78d292036f5a1a95129fb3adb4b2d6d889f8cc.tar.gz micropoly-8d78d292036f5a1a95129fb3adb4b2d6d889f8cc.tar.bz2 micropoly-8d78d292036f5a1a95129fb3adb4b2d6d889f8cc.zip |
Populate $_GET from request url
Diffstat (limited to 'src/Main.php')
-rw-r--r-- | src/Main.php | 9 |
1 files changed, 9 insertions, 0 deletions
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]) { |