From d4cf0fd331ce5b91a053e4c164a275d4ae39209f Mon Sep 17 00:00:00 2001 From: Abdussamed <46815237+abdussamedulutas@users.noreply.github.com> Date: Sat, 8 Apr 2023 21:34:10 +0300 Subject: [PATCH] Route added --- Core/Route.php | 15 +++++++++++++++ index.php | 12 +++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Core/Route.php b/Core/Route.php index d98fd1c..8cf9590 100644 --- a/Core/Route.php +++ b/Core/Route.php @@ -151,6 +151,16 @@ return Route::$current; } + public static function Execute() + { + $route = Route::CheckCurrent(); + if($route === false) + { + Response::Code(404); + }; + $route->call(); + } + public static function from(...$args) { return new Route(...$args); @@ -173,6 +183,11 @@ { $this->match = null; } + public function call(...$args) + { + $callback = $this->callback; + $callback(...$args); + } public function Run() { $requestUrl = Request::$url; diff --git a/index.php b/index.php index 82b4225..dd5b058 100644 --- a/index.php +++ b/index.php @@ -1,2 +1,12 @@ "Bir hata oluştu !" + ]); + }); + + Route::Execute(); \ No newline at end of file