Home  >  Article  >  Backend Development  >  php调用系统命令加压缩,该怎么解决

php调用系统命令加压缩,该怎么解决

WBOY
WBOYOriginal
2016-06-13 13:44:04884browse

php调用系统命令加压缩
怎么用php调用系统命令来实现解压缩上传的压缩文件呢, 最起码能解压zip格式的,其他的像rar 或者gz的都行啊

------解决方案--------------------
1.必须安装tar或gzip命令行工具:
将当前目录下所有的.txt文件打包并压缩到文件exp.tar.gz
tar czvf exp.tar.gz ./*.txt
将当前目录下的this.tar.gz中的文件解压缩到当前目录
tar xzvf exp.tar.gz ./
2.使用php调用命令行工具:

PHP code

   @system('tar czvf exp.tar.gz ./*.txt'); <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn