-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathengine.php
More file actions
44 lines (38 loc) · 832 Bytes
/
Copy pathengine.php
File metadata and controls
44 lines (38 loc) · 832 Bytes
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
<?php
// require_once 'core/router.php';
require_once 'loader/autoloader.php';
$router = new Router([
new Route(
'/',
function ($context) {
return Viewer::view('/main.php', $context);
}
),
new Route(
'/test',
function ($context) {
return Viewer::view('/test.php', $context);
}
),
new Route(
'/test/{id}',
function ($context) {
return Viewer::view('/test.php', $context);
}
),
new Route(
'/test/{user}',
function ($context) {
return Viewer::response('PHP York '.json_encode($context));
}
),
]);
/*
* @Test
* Test with /home?id=2
*
*/
$router->route('/home', function ($context) {
return Viewer::view('/main.php', $context);
});
$router->launch();