PHP ZIP files on the fly

前端 未结 7 1771
有刺的猬
有刺的猬 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:28

    If you have access to the zip commandline utility you can try

    
    

    where files is the things you want to zip and zip the location to the zip executable.

    This assumes Linux or similar, of course. In Windows you might be able to do similar with another compression tool, I guess.

    There's also a zip extension, usage shown here.

提交回复
热议问题