PHP ZIP files on the fly

前端 未结 7 1769
有刺的猬
有刺的猬 2020-12-02 17:06

What\'s the easiest way to zip, say 2 files, from a folder on the server and force download? Without saving the \"zip\" to the server.

    $zip = new ZipArc         


        
7条回答
  •  抹茶落季
    2020-12-02 17:21

    itsols If you want to insert the 'Content-Length' do it like this:

    $length = filesize($file);
    header('Content-Length: ' . $length);
    

    I don't know why, but it crashes if you put it in the same line.

提交回复
热议问题