-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
50 lines (34 loc) · 1006 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
40
41
42
43
44
45
46
47
48
49
50
<?php
//route management
//No matter user requesting pages. Request must arrive here.
//url
//base url+ /Student/Report
//first word denotes Controller and
// second word denotes Method inside controller.
//getting url
$url="";
if(empty($_GET["url"])) {
//depends on your choice
//which page you want to open at startup
$url="HomePage/Display";
}
else{
$url=$_GET["url"];
}
$url=explode('/', $url);
//printring after separation of controller and method.
//print_r($url);
$controller=$url[0]."Controller";
$method=$url[1];
//calling the function of controller
try {
require_once 'controllers/'.$controller.'.php';
$obj = new $controller();
$obj->$method();
} catch(\Error $ex) {
var_dump($ex);
echo "Not found: 404 page implementation goes here..";
}
//while linking files in another file
//we can use three approach
?>