Update index.php

This commit is contained in:
Namhyeon Go 2018-01-01 03:31:24 +09:00 committed by GitHub
parent 0f9f37ab11
commit d76b8e95f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,9 @@
define("_DEF_VSPF_", true);
ini_set("max_execution_time", 0);
error_reporting(E_ALL);
ini_set("display_errors", 1);
// including vendor autoloader
include_once('./vendor/autoload.php');
@ -28,7 +31,7 @@ if(array_key_exists('route', $_REQUEST)) {
}
if(empty($route)) {
$route = 'welcome';
$route = 'index';
} else {
$route_names = explode('/', $route);
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
$route_file_name = './route/' . $route . '.php';
if(file_exists($route_file_name)) {
include($route_file_name);
} else {
echo "404 Not Found";
include('./route/errors/404.php');
}