ThinkPHP6上传zip文件并解压缩
function uploadFile($key){$file = request()->file('file_name');try{// 验证文件格式validate(['file'=>['fileExt' => 'zip','fileMime' => 'application/zip']])->check(['file' => $file]);// 移动到框架应用根目录/public/uploads/zip 目录下$info = \think\facade\Filesystem::disk('public')->putFile( 'zip', $file);// 拼接上传后的文件绝对路径$uploadPath = str_replace('\\','/','./uploads/'.$info);// 定义解压路径$unzipPath = './uploads/unzip/'.date('Ymd').'/'.basename($uploadPath,".zip");// 实例化对象$zip = new \ZipArchive() ;//打开zip文档,如果打开失败返回提示信息if ($zip->open($uploadPath,\ZipArchive::CREATE) !== TRUE) {