Is there a way to uncompress .Z files using php?

前端 未结 2 372
终归单人心
终归单人心 2021-01-21 02:37

Is there a way to uncompress .Z files using php?

相关标签:
2条回答
  • After searching some i've found that .z files are files that were compressed using the compress program. If your php installation allows shell_exec and your webserver is running unix/linux you could run the uncompress program on your server. This is the (untested) idea:

    <?php
    $file = '/tmp/archive.z';
    shell_exec("uncompress $file");
    
    0 讨论(0)
  • 2021-01-21 03:30

    Nowadays uncompress is just nothing more than a one-liner invoking gzip with proper options. To use gzip, you don't have execute shell. You can use Zlib extension instead. I'd try something like:

    <?php
    $contents = zlib_decode(file_get_contents('/path/file.Z'));
    
    0 讨论(0)
提交回复
热议问题