How can I unzip a .gz file with PHP?

后端 未结 6 1055
南旧
南旧 2020-12-14 11:06

I\'m using CodeIgniter and I can\'t figure out how to unzip files!

6条回答
  •  清歌不尽
    2020-12-14 11:35

    Use the functions implemented by the Zlib Compression extension.

    This snippet shows how to use some of the functions made available from the extension:

    // open file for reading
    $zp = gzopen($filename, "r");
    
    // read 3 char
    echo gzread($zp, 3);
    
    // output until end of the file and close it.
    gzpassthru($zp);
    gzclose($zp);
    

提交回复
热议问题