Route added

This commit is contained in:
Abdussamed 2023-04-08 21:34:10 +03:00
parent 44933a4449
commit d4cf0fd331
2 changed files with 26 additions and 1 deletions

View File

@ -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;

View File

@ -1,2 +1,12 @@
<?php
include_once "Core/Core.php";
include_once "Core/Core.php";
Route::get("/",function(){
echo view("hello",[
"text" => "Bir hata oluştu !"
]);
});
Route::Execute();