rotas nomeadas corrigidas
This commit is contained in:
@@ -12,8 +12,7 @@ function load(string $controller, string $action){
|
||||
if(!method_exists($controllerInstance,$action)){
|
||||
throw new Exception("O método {$action} não existe");
|
||||
}
|
||||
|
||||
$controllerInstance->$action();
|
||||
$controllerInstance->$action((object)$_REQUEST);
|
||||
}catch(Exception $e){
|
||||
echo $e->getMessage();
|
||||
}
|
||||
@@ -21,10 +20,16 @@ function load(string $controller, string $action){
|
||||
|
||||
$router= [
|
||||
"GET"=>[
|
||||
"/projeto/api_educa/"=> fn()=> load("HomeController","index"),
|
||||
"/projeto/api_educa/login" => fn()=> load("LoginController","index")
|
||||
"/"=> fn()=> load("HomeController","index"),
|
||||
"/login" => fn()=> load("LoginController","index")
|
||||
],
|
||||
"POST"=>[
|
||||
"/projeto/api_educa/login" => fn()=> load("LoginController","store")
|
||||
"/login" => fn()=> load("LoginController","store")
|
||||
]
|
||||
];
|
||||
|
||||
//rodar local host
|
||||
//php -S localhost:8000
|
||||
|
||||
//depois chamar localhost:8000
|
||||
//http://localhost:8000/login?NO_USERNAME=AMENEZES
|
||||
|
||||
Reference in New Issue
Block a user