请问如何解压.tar.gz .gzip .gz 类型文档
我想上传一个文档到服务器, 格式有可能是tar.gz 或者gzip 也有可能是gz 格式文档. 然后通过PHP来解压.
我在网上找到些代码,可以实现上传并解压tar.gz格式文档到服务器, 其它格式比如gzip, gz无法上传解压成功(即服务器上传目录没文件).
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
$zipFile = $_FILES["file"]["tmp_name"];
$zp = @fopen($zipFile, "r");
$fp=popen('tar xzf - --overwrite --directory='.$uploadDir.'/','w');
while(!@feof($zp)) {
$string = @fread($zp, 4096);
@fwrite($fp, $string, strlen($string));
}
@fclose($zp);
@pclose($fp);
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号