buildRows(); $md = $svc->toMarkdownTable($rows); $path = $this->option('output'); if ($path) { $p = ltrim((string) $path, '/'); if (str_starts_with($p, 'docs/')) { $full = base_path($p); } elseif (str_starts_with((string) $path, '/') || (strlen((string) $path) > 2 && preg_match('/^[A-Za-z]:\\\\/', (string) $path))) { $full = (string) $path; } else { $full = storage_path('app/'.$p); } $dir = dirname($full); if (! is_dir($dir)) { File::makeDirectory($dir, 0755, true); } file_put_contents($full, $md); $this->info('已写入:'.$full); } $this->line($md); return self::SUCCESS; } }