modifs!!!!

This commit is contained in:
2019-02-18 15:05:33 +01:00
parent 7bd6b67ccf
commit c4177f1f10
14 changed files with 158 additions and 84 deletions

View File

@ -8,12 +8,14 @@
*/
class Router {
//variable static pour stocker le router
private static $router;
private static $router = null;
//definit le router
public function __construct() {
//TODO faire que si un router existe déjà retourner le routeur existant
Router::$router = $this;
if(Router::$router != null) {
return Router::$router;
} else Router::$router = $this;
}
//fonction static pour recuperer un router déjà crée
@ -42,4 +44,10 @@ class Router {
return file_get_contents("../html/404.html");
};
}
public function redirecter($source, $redirectPage) {
$this->addRoute($source, function() {
header("Location: " . $redirectPage);
});
}
}