生成的话从数据库获取,用toJson()来转换为json数据格式,然后存在json文本里面。

使用一个空数组,存储所有要下载的文件的路径。

$zipname = date('YmdHms',time()).'.zip';

        $zip = new ZipArchive;
        if ($zip->open($zipname,ZIPARCHIVE::CREATE) === TRUE)
        {
            foreach($fileArray as $file)
            {
                $zip->addFile($file);
            }
            $zip->close();
        }
        return response()->download(public_path().'/'.$zipname);

  

相关文章:

  • 2022-02-05
  • 2021-06-20
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
猜你喜欢
  • 2021-07-07
  • 2022-02-15
  • 2022-01-14
  • 2022-12-23
  • 1970-01-01
  • 2022-02-01
相关资源
相似解决方案