How can I unzip a .gz file with PHP?

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

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

6条回答
  •  醉话见心
    2020-12-14 11:27

    Use the extractTo function from PharData.

    $source is the .gz archive file you want to unzip and $destDir the directory you want to extract them to.

    $phar = new PharData($source);
    $phar->extractTo($destDir,null,true); // extract all files, overwrites existing files
    

提交回复
热议问题