Skip to content

Commit 9812f86

Browse files
authored
Update GenerateDocumentCommand.php
1 parent e8c6011 commit 9812f86

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/DocumentBundle/Command/GenerateDocumentCommand.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ public function execute(InputInterface $input, OutputInterface $output)
8585
$this->generateDebugFile();
8686

8787
//>3 生成打包件
88-
$zip = Zip::create($this->rootApiDir() . DIRECTORY_SEPARATOR . $this->jsonToArray($this->global)['title'] . 'API文档.zip');
89-
$zip->add($this->rootApiDir());
88+
if(class_exists(\ZipArchive::class)) {
89+
$zip = Zip::create($this->rootApiDir() . DIRECTORY_SEPARATOR . $this->jsonToArray($this->global)['title'] . 'API文档.zip');
90+
$zip->add($this->rootApiDir());
91+
}
9092

9193
$this->io->success('生成成功');
9294

@@ -313,9 +315,11 @@ function topHtml($type, $other_head = '')
313315

314316
switch ($type){
315317
case 1:
316-
$html .= <<<EOF
318+
if(class_exists(\ZipArchive::class)) {
319+
$html .= <<<EOF
317320
<li><a href="{$this->jsonToArray($this->global)['title']}API文档.zip">打包ZIP</a></li>
318321
EOF;
322+
}
319323
break;
320324
case 3:
321325
$html .= <<<EOF

0 commit comments

Comments
 (0)