-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouter.php
37 lines (32 loc) · 957 Bytes
/
router.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
<?php
# # # # # # # # # #
# Setting router #
# # # # # # # # # #
#
# for NginX, put it into configuration file.
#
// location ^~ /router/ {
// root /var/www/html/router;
// include fastcgi_params;
// fastcgi_param SCRIPT_FILENAME $document_root/router.php;
// fastcgi_pass unix:/run/php/php-fpm.sock;
// }
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# DO NOT output any stuff on this page
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
// init
require('init.php');
// init router
Inc::clas('Router');
Router::init(substr($_SERVER['SCRIPT_NAME'], strlen(Root) - 1));
// ID of Current Page
define('ID', Router::tryFile() === false ? false : ID(Router::tryFile()));
// Router::tryFile() === false ? false : ID(Router::tryFile())
Router::get(['/img/', '/js/', '/css/', '/plugin/'], 'asset');
Router::get('/auth/', 'auth');
Router::get('/api/', 'api');
Router::get('/', 'page');
http_response_code(404);