Commit 62eb3da4 authored by jiangkebao's avatar jiangkebao

打包

parent 99a3448c
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
"hyperf/logger": "~1.1.0", "hyperf/logger": "~1.1.0",
"hyperf/service-governance": "~1.1.0", "hyperf/service-governance": "~1.1.0",
"fzaninotto/faker": "^1.9", "fzaninotto/faker": "^1.9",
"phpoffice/phpspreadsheet": "^1.8" "phpoffice/phpspreadsheet": "^1.8",
"chumper/zipper": "dev-master"
}, },
"minimum-stability": "dev", "minimum-stability": "dev",
"autoload": { "autoload": {
......
<?php
namespace Meibuyu\Micro\Tools;
use Chumper\Zipper\Zipper;
/**
* 打包器
* Class PackFiler
*/
class Unpacker
{
//文件列表 一位数组
public $fileList;
//保存路径
public $path;
//文件名
public $fileName;
public function __construct(array $fileList, $path, $fileName)
{
$this->fileList = $fileList;
$this->path = $path;
$this->fileName = $fileName;
}
/**
* 打包
* @return string
* @throws \Exception
*/
public function unpack()
{
$zipper = new Zipper();
$filePath = $this->path.'/'.$this->fileName.'.zip';
$zipper->make($filePath)->add($this->fileList);
$zipper->close();
return $filePath;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment