-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDao.php
32 lines (25 loc) · 940 Bytes
/
Dao.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
<?php
include 'configuracion/Redireccion.php';
include 'configuracion/ConsultaMysql.php';
class Dao {
var $respuesta;
var $conexion_base_datos;
function get_nombre_modelo($nombre_controlador) {
return $explode("Controller", $nombre_controlador)[0];
}
function carga_modelo($modelo) {
$this->respuesta = array();
try {
if (!@include_once 'Modelo/' . $modelo . '.php') {
throw new Exception('No se encuentra el archivo' . $modelo . '.php <br> En la carpeta Modelo');
}
$this->conexion_base_datos = new ConsultaMysql();
return $modelo;
} catch (Exception $e) {
$_SESSION['respuesta']['error'] = $this->respuesta['error'] = "No se encuentra el archivo " . $modelo . '.php <br> En la carpeta Modelo';
$error = new Error();
Redireccion::Direccionar($error, "index");
}
}
}
?>