0 && $path[0] !== '/'; } /** * 创建目录(如果不存在) * * @param string $path 目录路径 */ public static function createIfNotExists(string $path): void { if (!is_dir($path) && !mkdir($path, 0777, true) && !is_dir($path)) { throw new RuntimeException(sprintf('无法建立目录:%s', $path)); } } }