-
Notifications
You must be signed in to change notification settings - Fork 0
/
Index.php
45 lines (32 loc) · 1.33 KB
/
Index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
require_once 'Config/Database.php';
$controller = 'login';
if(!isset($_REQUEST['c']))
{
require_once "Controller/$controller.controller.php";
if (file_exists("Controller/$controller.controller.php")) {
$controller = ucwords($controller).'Controller';
$controller = new $controller;
$controller->Index();
}else{
echo "VERIFIQUE QUE ESTEN CREADO LOS SIGUIENTES ARCHIVOS: </br><br>CONTROLADOR:Controller/".$controller.".controller.php<br>MODELO:Model/".$controller."Model.php<br>VISTA: View/".$controller."/Index";
}
}
else
{
// Obtenemos el controlador que queremos cargar
$controller = strtolower($_REQUEST['c']);
$accion = isset($_REQUEST['a']) ? $_REQUEST['a'] : 'Index';
try{
if (file_exists("Controller/$controller.controller.php")) {
require_once("Controller/$controller.controller.php");
$controller = ucwords($controller) . 'Controller';
$controller = new $controller;
call_user_func(array($controller, $accion));
}else{
echo "VERIFIQUE QUE ESTEN CREADO LOS SIGUIENTES ARCHIVOS: </br><br>CONTROLADOR:Controller/".$controller.".controller.php<br>MODELO:Model/".$controller."Model.php<br>VISTA: View/".$controller."/Index";
}
}catch(Exception $e){
echo $e;
}
}