问题
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