update:更新zip类

This commit is contained in:
JaguarJack 2020-08-10 11:17:32 +08:00
parent bcf37924d3
commit e15838386f

View File

@ -30,16 +30,17 @@ class Zip
* *
* @time 2020年07月19日 * @time 2020年07月19日
* @param $zip * @param $zip
* @throws \Exception * @param null $flags
* @return $this * @return $this
* @throws \Exception
*/ */
public function make($zip) public function make($zip, $flags = null)
{ {
if (FileSystem::extension($zip) != self::EXTENSION) { if (FileSystem::extension($zip) != self::EXTENSION) {
throw new \Exception("make zip muse set [zip] extension"); throw new \Exception("make zip muse set [zip] extension");
} }
$this->zipArchive->open($zip, \ZipArchive::CREATE); $this->zipArchive->open($zip, $flags);
return $this; return $this;
} }
@ -113,7 +114,9 @@ class Zip
*/ */
public function close() public function close()
{ {
$this->zipArchive->close(); if ($this->zipArchive) {
$this->zipArchive->close();
}
} }
} }