Sfoglia il codice sorgente

Fixed:pathinfo 不支持问题

Jinhui Zhu 7 anni fa
parent
commit
02087f816f
2 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 1 1
      src/Request/Url.php
  2. 1 1
      src/Router/Parse/Normal.php

+ 1 - 1
src/Request/Url.php

@@ -40,7 +40,7 @@ class Url
      */
     public static function getPathInfo()
     {
-        return PATH_INFO;
+        return PATH_INFO ? PATH_INFO : explode('?', $_SERVER['REQUEST_URI'])[0];
     }
 
     /**

+ 1 - 1
src/Router/Parse/Normal.php

@@ -48,7 +48,7 @@ class Normal
         if (!$this->config) {
             return array('controller' => $controller, 'action' => $action);
         }
-        if($url == '') $url = 'index/index.html';
+        if($url == '' || $url == '/') $url = 'index/index.html';
         $url = ltrim($url, '/');
         $dirName = pathinfo($url, PATHINFO_DIRNAME);
         $dirInfo = explode('/', $dirName);