Ejemplo n.º 1
0
 public static function getBaseUri($reload = false)
 {
     if ($reload || is_null(self::$baseUri)) {
         $requestUri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF'];
         //Full Request URI
         $scriptName = $_SERVER['SCRIPT_NAME'];
         //Script path from docroot
         $baseUri = strpos($requestUri, $scriptName) === 0 ? $scriptName : str_replace('\\', '/', dirname($scriptName));
         self::$baseUri = rtrim($baseUri, '/');
     }
     return self::$baseUri;
 }