31 lines
No EOL
754 B
PHP
31 lines
No EOL
754 B
PHP
<?php
|
|
session_start();
|
|
require(__DIR__ . "/vendor/autoload.php");
|
|
|
|
// Environnement
|
|
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
|
$dotenv->safeLoad();
|
|
|
|
$strCtrl = $_GET['ctrl'] ?? 'project';
|
|
$strMethod = $_GET['action'] ?? 'home';
|
|
|
|
$strClassName = "Controllers\\" . ucfirst($strCtrl) . "Ctrl";
|
|
|
|
$boolError = false;
|
|
|
|
if (class_exists($strClassName)) {
|
|
$objController = new $strClassName();
|
|
|
|
if (method_exists($objController, $strMethod)) {
|
|
$objController->$strMethod();
|
|
} else {
|
|
$boolError = true;
|
|
}
|
|
} else {
|
|
$boolError = true;
|
|
}
|
|
|
|
if ($boolError) {
|
|
$error = new \Controllers\ErrorCtrl();
|
|
return $error->error_404();
|
|
} |