Example #1
0
 public static function getSchemaByApp($app)
 {
     $cache_key = "schema/" . $app;
     $schemas = (array) S($cache_key);
     if (DEBUG || !$schemas) {
         $path = sprintf("%s%s/Schema", APP_PATH, ucfirst($app));
         foreach (new RecursiveFileFilterIterator($path, null, "yml") as $item) {
             $schemas = array_merge($schemas, (array) parse_yml($item));
         }
         // 需返回的数据表
         $tables = I("get.table") ? explode(".", I("get.table")) : array_keys($schemas);
         $schemas = Schema::parse($app, $schemas, $tables);
         S($cache_key, $schemas);
     }
     return $schemas;
 }