Create a zip file using PHP class ZipArchive without writing the file to disk?

后端 未结 4 1278
梦谈多话
梦谈多话 2020-12-08 14:40

I would like to create a zip file in memory using a ZipArchive (or a native PHP class) and read the content of the file back to the client. Is this possible? If so, how?

4条回答
  •  情话喂你
    2020-12-08 15:04

    Try ZipStream (link to GitHub repo, also supports install via Composer).

    From original author's website (now dead):

    ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.

提交回复
热议问题