reasonableframework/index.php

48 lines
959 B
PHP
Raw Normal View History

2017-12-17 20:40:04 +00:00
<?php
/*
* VerySimplePHPFramework
2017-12-22 18:41:57 +00:00
* http://github.com/gnh1201/verysimplephpframework
2017-12-17 20:40:04 +00:00
* Go Namhyeon <gnh1201@gmail.com>
2017-12-22 18:41:57 +00:00
* Date: 2017-12-23
2017-12-17 20:40:04 +00:00
*/
2017-12-22 19:04:01 +00:00
define("_DEF_VSPF_", true);
2017-12-17 20:40:04 +00:00
// including vendor autoloader
include_once('./vendor/autoload.php');
2017-12-22 18:34:40 +00:00
// load system files
$load_systems = array('config', 'database', 'uri');
foreach($load_systems as $system_name) {
$system_inc_file = './system/' . $system_name . '.php';
if(file_exists($system_inc_file)) {
include_once($system_inc_file);
}
}
2017-12-17 20:40:04 +00:00
// route controller
$route = '';
if(array_key_exists('route', $_REQUEST)) {
$route = $_REQUEST['route'];
}
if(empty($route)) {
$route = 'welcome';
} else {
$route_names = explode('/', $route);
if(count($route) > 1) {
$route = end($route_names);
}
}
// view render
function renderView($name) {
$viewfile = './view/' . $name . '.php';
if(file_exists($viewfile)) {
2017-12-17 20:44:10 +00:00
include($viewfile);
2017-12-17 20:40:04 +00:00
}
}
// including route file
include('./route/' . $route . '.php');