Creating a GZipped tar file and dynamically streaming it via PHP?

北慕城南 提交于 2019-12-01 17:43:34

问题


Is there an easy interface like ZipArchive for tar.gz archives that allows me to stream the archive to the client rather than save it on the server? And if so, could someone show me how?

Thanks!


回答1:


This link may be useful to you. Can you be more specific on not wanting the file to be temporarily on the filesystem?

http://www.clker.com/blog/2008/03/27/creating-a-tar-gz-on-the-fly-using-php/




回答2:


You can direct the tar command with passthru() or exec() to send the tar.gz file to stdout. E.g.

tar cfz - name1 name2 ...


来源:https://stackoverflow.com/questions/10162759/creating-a-gzipped-tar-file-and-dynamically-streaming-it-via-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!