$p) { $currentPath = '/'; $currentArr = array_slice($pathArr, 0, $k); if ($currentArr) { $currentPath = "/".implode('/', $currentArr)."/"; } if ($currentPath != '/' && self::where('path', $currentPath)->where('name', $p)->count() <= 0) { $arr = []; $arr['path'] = $currentPath; $arr['name'] = $p; $arr['created_at'] = $now; $arr['is_dir'] = self::COMMON_ON; $arr['type'] = self::TYPE_DIR; $insert[] = $arr; } } (new self())->saveAll($insert); return true; } catch (Exception $e) { return false; } } }