php decompress rar file php package zip file source code php_rar.dll pclzip example

高洛峰
Release: 2016-11-28 16:45:05
Original
1334 people have browsed it

define('ROOT_DIR','D:/web/');
  
$rar = '2012051008.rar';
$rar_name = basename($rar,'.rar');
  
$rar_file = rar_open(ROOT_DIR.$rar) or die("失败");
$entries = rar_list($rar_file);
$arr_name = array();
foreach($entries as $entry){
    $name = $entry->getName();
    if(substr($name,-4) == '.txt') {
        $entry->extract(ROOT_DIR);
        $arr_name[] = $name;
    }  
}
rar_close($rar_file);
  
$arr_name = array('2012051008.txt','说明.txt');
$file = ROOT_DIR.$rar_name.'.zip';
require('./pclzip.lib.php');
$zip = new pclzip($file);
$list = $zip->create($arr_name);
if($list != 0) {
    foreach($arr_name as $key=>$val) {
        unlink(ROOT_DIR.$val);
    }
}
Copy after login

php decompress rar file php package zip file source code php_rar.dll pclzip example


Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!