You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SAE4.01_FORMULAIRE/Source/Controller/FrontController.php

32 lines
853 B

<?php
namespace Controller;
use Exception;
use PDOException;
class FrontController
{
public function __construct()
{
$listControllers = array("\\Controller\\ControllerCandidate", "\\Controller\\ControllerAdmin");
global $rep, $views;
$dVueError = array();
try {
$action = $_REQUEST['action'] ? $action = $_REQUEST['action'] : (new ControllerCandidate())->goToForm();
foreach ($listControllers as $controller) {
if (method_exists($controller, $action)) {
(new $controller)->$action(); // Si oui, on appelle cette fonction
}
}
} catch (PDOException|Exception $e) {
$dVueError[] = "Erreur innatendue !"; // Ecriture du message d'erreur
echo "ERREUUUUUR";
}
exit(0);
}
}