|
@@ -41,15 +41,20 @@ class SimpleRouter implements Router
|
41
|
41
|
if ($basePath) {
|
42
|
42
|
return $basePath;
|
43
|
43
|
}
|
44
|
|
- $fullPath = explode('?', $_SERVER['REQUEST_URI'])[0];
|
45
|
|
- $path = $_SERVER['PATH_INFO'];
|
46
|
|
- if (!$path) {
|
|
44
|
+ if (isset($_SERVER['REQUEST_URI'])) {
|
|
45
|
+ $fullPath = explode('?', $_SERVER['REQUEST_URI'])[0];
|
|
46
|
+ if (isset($_SERVER['PATH_INFO'])) {
|
|
47
|
+ $path = $_SERVER['PATH_INFO'];
|
|
48
|
+ if (!$path) {
|
|
49
|
+ return $_SERVER['PHP_SELF'];
|
|
50
|
+ }
|
|
51
|
+ if (substr($fullPath, -1 * strlen($path)) == $path) {
|
|
52
|
+ return substr($fullPath, 0, -1 * strlen($path));
|
|
53
|
+ }
|
|
54
|
+ }
|
47
|
55
|
return $fullPath;
|
48
|
56
|
}
|
49
|
|
- if (substr($fullPath, -1 * strlen($path)) == $path) {
|
50
|
|
- return substr($fullPath, 0, -1 * strlen($path));
|
51
|
|
- }
|
52
|
|
- return $_SERVER['PHP_SELF'];
|
|
57
|
+ return '/';
|
53
|
58
|
}
|
54
|
59
|
|
55
|
60
|
private function loadPathTree(): PathTree
|