Update index.php
This commit is contained in:
parent
0f9f37ab11
commit
d76b8e95f6
19
index.php
19
index.php
|
@ -9,6 +9,9 @@
|
||||||
define("_DEF_VSPF_", true);
|
define("_DEF_VSPF_", true);
|
||||||
ini_set("max_execution_time", 0);
|
ini_set("max_execution_time", 0);
|
||||||
|
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set("display_errors", 1);
|
||||||
|
|
||||||
// including vendor autoloader
|
// including vendor autoloader
|
||||||
include_once('./vendor/autoload.php');
|
include_once('./vendor/autoload.php');
|
||||||
|
|
||||||
|
@ -28,7 +31,7 @@ if(array_key_exists('route', $_REQUEST)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($route)) {
|
if(empty($route)) {
|
||||||
$route = 'welcome';
|
$route = 'index';
|
||||||
} else {
|
} else {
|
||||||
$route_names = explode('/', $route);
|
$route_names = explode('/', $route);
|
||||||
if(count($route) > 1) {
|
if(count($route) > 1) {
|
||||||
|
@ -36,22 +39,10 @@ if(empty($route)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// view render
|
|
||||||
function renderView($name, $data=array()) {
|
|
||||||
if(count($data) > 0) {
|
|
||||||
extract($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
$viewfile = './view/' . $name . '.php';
|
|
||||||
if(file_exists($viewfile)) {
|
|
||||||
include($viewfile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// including route file
|
// including route file
|
||||||
$route_file_name = './route/' . $route . '.php';
|
$route_file_name = './route/' . $route . '.php';
|
||||||
if(file_exists($route_file_name)) {
|
if(file_exists($route_file_name)) {
|
||||||
include($route_file_name);
|
include($route_file_name);
|
||||||
} else {
|
} else {
|
||||||
echo "404 Not Found";
|
include('./route/errors/404.php');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user