Browse Source

better basePath support

Maurits van der Schee 5 years ago
parent
commit
84c7dc15a4
2 changed files with 2 additions and 8 deletions
  1. 1
    4
      api.php
  2. 1
    4
      src/Tqdev/PhpCrudApi/Middleware/Router/SimpleRouter.php

+ 1
- 4
api.php View File

@@ -4812,14 +4812,11 @@ class SimpleRouter implements Router
4812 4812
         if (isset($_SERVER['PATH_INFO'])) {
4813 4813
             $fullPath = explode('?', $_SERVER['REQUEST_URI'])[0];
4814 4814
             $path = $_SERVER['PATH_INFO'];
4815
-            if (!$path) {
4816
-                return $_SERVER['PHP_SELF'];
4817
-            }
4818 4815
             if (substr($fullPath, -1 * strlen($path)) == $path) {
4819 4816
                 return substr($fullPath, 0, -1 * strlen($path));
4820 4817
             }
4821 4818
         }
4822
-        return '/';
4819
+        return $_SERVER['PHP_SELF'];
4823 4820
     }
4824 4821
 
4825 4822
     private function loadPathTree(): PathTree

+ 1
- 4
src/Tqdev/PhpCrudApi/Middleware/Router/SimpleRouter.php View File

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

Loading…
Cancel
Save