-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
39 lines (33 loc) · 892 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
32
33
34
35
36
37
38
39
<?php
/**
* Created by PhpStorm.
* User: Skylark
* Date: 2/5/2019
* Time: 12:41 PM
*/
// ENTRY POINT: selects the controller which should be loaded and then calls the getBody func.
require_once "config.php";
header("Content-Type:text/html;charset='utf-8'");
function __autoload($file){
if(file_exists('controllers/' . $file . '.php')){
require_once 'controllers/' . $file . '.php';
}elseif(file_exists('models/' . $file . '.php')){
require_once 'models/' . $file . '.php';
}
}
//http://mvc.solo/index.php?option=view //option=controllerNAME
if(isset($_GET['option'])){
$class = strip_tags(ucfirst($_GET['option']));
$init = null;
switch($class){
case 'View':
$init = new $class;
break;
default:
$init = new Index;
break;
}
}else{
$init = new Index;
}
echo $init->getBody();