Cml\Route::getPathInfo PHP Method

getPathInfo() public static method

获取解析后的pathInfo信息
public static getPathInfo ( ) : array
return array
    public static function getPathInfo()
    {
        return self::$pathInfo;
    }

Usage Example

Example #1
0
 /**
  * 解析一个静态资源的内容
  *
  */
 public static function parseResourceFile()
 {
     $pathinfo = Route::getPathInfo();
     array_shift($pathinfo);
     $resource = implode('/', $pathinfo);
     if (Cml::$debug) {
         $appName = $file = '';
         $i = 0;
         while (true) {
             $resource = ltrim($resource, '/');
             $pos = strpos($resource, '/');
             $appName = ($appName == '' ? '' : $appName . DIRECTORY_SEPARATOR) . substr($resource, 0, $pos);
             $resource = substr($resource, $pos);
             $file = Cml::getApplicationDir('apps_path') . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR . Cml::getApplicationDir('app_static_path_name') . $resource;
             if (is_file($file) || ++$i >= 3) {
                 break;
             }
         }
         if (is_file($file)) {
             Response::sendContentTypeBySubFix(substr($resource, strrpos($resource, '.') + 1));
             exit(file_get_contents($file));
         } else {
             Response::sendHttpStatus(404);
         }
     }
 }
All Usage Examples Of Cml\Route::getPathInfo