-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
52 lines (43 loc) · 1.23 KB
/
index.php
File metadata and controls
52 lines (43 loc) · 1.23 KB
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
51
52
<?php
// Include router class
include('Route.php');
Route::add('/',[
"path" => "Controls/HomePageControl.php",
"class" => "HomePageControl",
"fun" => "index",
]);
//// Simple test route that simulates static html file
//Route::add('/test',function(){
// echo 'Hello from test.html';
//});
Route::add('/names',[
"path" => "Controls/NamesControl.php",
"class" => "NamesControl",
"fun" => "index",
],'post');
Route::add('/names/create',[
"path" => "Controls/NamesControl.php",
"class" => "NamesControl",
"fun" => "create",
],'post');
Route::add('/names/delete/{id}',[
"path" => "Controls/NamesControl.php",
"class" => "NamesControl",
"fun" => "delete",
],'delete');
//// Post route example
//Route::add('/contact-form',function(){
// echo '<form method="post"><input type="text" name="test" /><input type="submit" value="send" /></form>';
//},'get');
//
//// Post route example
//Route::add('/contact-form',function(){
// echo 'Hey! The form has been sent:<br/>';
// print_r($_POST);
//},'post');
//
//// Accept only numbers as parameter. Other characters will result in a 404 error
//Route::add('/foo/([0-9]*)/bar',function($var1){
// echo $var1.' is a great number!';
//});
Route::run('/');