rotas nomeadas corrigidas
This commit is contained in:
16
index.php
16
index.php
@@ -1,11 +1,13 @@
|
||||
<?php
|
||||
require "vendor/autoload.php";
|
||||
require "routes/router.php";
|
||||
require_once('app/classes/conexao.class.php');
|
||||
|
||||
try{
|
||||
|
||||
$uri = parse_url($_SERVER["REQUEST_URI"])['path'];
|
||||
$request = $_SERVER["REQUEST_METHOD"];
|
||||
|
||||
if(!isset($router[$request])){
|
||||
throw new Exception("A rota não existe");
|
||||
}
|
||||
@@ -13,10 +15,6 @@ try{
|
||||
if(!array_key_exists($uri,$router[$request])){
|
||||
throw new Exception("A rota não existe");
|
||||
}
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($request);
|
||||
|
||||
$controller = $router[$request][$uri];
|
||||
$controller();
|
||||
|
||||
@@ -54,7 +52,13 @@ try{
|
||||
//url para retonar o login 61
|
||||
//http://localhost/projeto/api_educa/index.php/?idf=61
|
||||
//http://localhost/projeto/api_educa/index.php/?idf=66
|
||||
//http://192.168.18.2/projeto/api_educa/index.php/?NO_USERNAME=AMENEZES
|
||||
//http://192.168.18.2/?NO_USERNAME=AMENEZES
|
||||
|
||||
//aprendendo rotas
|
||||
//https://www.youtube.com/watch?v=h7K-KUZ3Rvw
|
||||
//https://www.youtube.com/watch?v=h7K-KUZ3Rvw
|
||||
|
||||
//dados na home
|
||||
//http://localhost:8000/?name=reginaldo
|
||||
|
||||
//dados do login
|
||||
//http://localhost:8000/login?NO_USERNAME=AMENEZES
|
||||
Reference in New Issue
Block a user