namespace de fait hehe
This commit is contained in:
parent
6c21a5f1cb
commit
0638834933
23 changed files with 131 additions and 81 deletions
39
index.php
39
index.php
|
|
@ -1,36 +1,31 @@
|
|||
<?php
|
||||
|
||||
session_start();
|
||||
require(__DIR__ . "/vendor/autoload.php");
|
||||
|
||||
//environnement
|
||||
// Environnement
|
||||
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
||||
$dotenv->safeLoad();
|
||||
|
||||
$strCtrl = $_GET['ctrl']??'project';
|
||||
$strMethod = $_GET['action']??'home';
|
||||
$strCtrl = $_GET['ctrl'] ?? 'project';
|
||||
$strMethod = $_GET['action'] ?? 'home';
|
||||
|
||||
$boolError = false;
|
||||
$strFileName = "./controllers/".$strCtrl."_controller.php";
|
||||
$strClassName = "Controllers\\" . ucfirst($strCtrl) . "Ctrl";
|
||||
|
||||
if(file_exists($strFileName)){
|
||||
require($strFileName);
|
||||
$strClassName = ucfirst($strCtrl)."Ctrl";
|
||||
if(class_exists($strClassName)){
|
||||
$objController = new $strClassName();
|
||||
if(method_exists($objController,$strMethod)){
|
||||
$objController->$strMethod ();
|
||||
}else{
|
||||
$boolError = true;
|
||||
}
|
||||
}else{
|
||||
$boolError = false;
|
||||
|
||||
if (class_exists($strClassName)) {
|
||||
$objController = new $strClassName();
|
||||
|
||||
if (method_exists($objController, $strMethod)) {
|
||||
$objController->$strMethod();
|
||||
} else {
|
||||
$boolError = true;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$boolError = true;
|
||||
}
|
||||
|
||||
if($boolError){
|
||||
header("Location:index.php?ctrl=error&action=error_404");
|
||||
}
|
||||
|
||||
if ($boolError) {
|
||||
header("Location: index.php?ctrl=error&action=error_404");
|
||||
exit;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue