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

只谈情不闲聊 提交于 2019-12-20 02:49:09

问题


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


回答1:


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'));



回答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");


来源:https://stackoverflow.com/questions/10174917/is-there-a-way-to-uncompress-z-files-using-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!