-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
31 lines (25 loc) · 831 Bytes
/
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
<?php
session_start();
header('Content-type: text/html; Charset=utf-8');
define ('BASE_PATH', dirname(__FILE__));
class App{
public static $config = null;
public static function getConfig($key) {
if (self::$config === null) {
self::$config = include_once 'app/config/main.php';
}
return isset(self::$config[$key]) ? self::$config[$key] : false;
}
}
function my_autoloader($class) {
if(file_exists('app/model/' .$class. '.php')){
include_once 'app/model/' .$class. '.php';
}elseif (file_exists('app/controller/' .$class. '.php')) {
include_once 'app/controller/' .$class. '.php';
}
}
spl_autoload_register('my_autoloader');
$route = ucfirst($_GET['r']) . 'Controller';
$action = ($_GET['a']);
$controller = new $route;
$controller->{$action}();