-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
30 lines (19 loc) · 814 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
<?php
require_once __DIR__.'/autoload/autoload.php';
$ctrl = isset( $_GET['ctrl'] ) ? $_GET['ctrl'] : 'home';
$act = isset( $_GET['act'] ) ? $_GET['act'] : 'Index';
$controllerClassName = $ctrl.'Controller';
require_once __DIR__.'/controllers/'.$controllerClassName.'.php';
$controller = new $controllerClassName;
$method = 'action'.$act;
$controller->$method();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
require_once __DIR__.'/autoload/autoload.php';
$ctrl = isset( $_POST['ctrl'] ) ? $_POST['ctrl'] : 'home';
$act = isset( $_POST['act'] ) ? $_POST['act'] : 'Index';
$controllerClassName = $ctrl.'Controller';
require_once __DIR__.'/controllers/'.$controllerClassName.'.php';
$controller = new $controllerClassName;
$method = 'action'.$act;
$controller->$method();
}