>  기사  >  类库下载  >  php rar 파일 압축 풀기 php 패키지 zip 파일 소스 코드 php_rar.dll pclzip 예제

php rar 파일 압축 풀기 php 패키지 zip 파일 소스 코드 php_rar.dll pclzip 예제

高洛峰
高洛峰원래의
2016-10-14 10:32:551429검색

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

php rar 파일 압축 풀기 php 패키지 zip 파일 소스 코드 php_rar.dll pclzip 예제

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

관련 기사

더보기