導航:首頁 > 文件處理 > php解壓縮文件

php解壓縮文件

發布時間:2025-02-19 21:56:53

1. 求php壓縮解壓rar和zip類源碼

不用寫,rar演算法是有專利權的

RAR壓縮演算法是RARLab的專利,其它軟體要使用或自己實現RAR演算法的實作,都是要向RARLab申請許可或交錢的

zip演算法php有自帶的函數
====>
需求
PHP 4
The bundled PHP 4 version requires » ZZIPlib, by Guido Draheim, version 0.10.6 or later

PHP 5.2.0 or later
This extension uses the functions of » zlib by Jean-loup Gailly and Mark Adler.
=====>
所以用RAR只有通過命令行調用已經安裝的rar程序實現打包,效果是一樣的.具體調用方法參考各自軟體說明.winrar也能用命令行調用,請看http://ke..com/view/2345.htm

2. 請高手指點:PHP 如何解壓縮zip格式壓縮的文件或壓縮文件夾內的文件到指定目錄

/**
* PHP在線壓縮/解壓實例
*/

date_default_timezone_set('prc');

$zip = new engine_compress_decompress();

if (isset($_POST))
{
$sourcePath = ''; //默認位置

if (isset($_FILES['upfile'])) //上傳文件
{
$stmp = $zip->fileUpload('upfile');
$sourcePath = $stmp['sourcefile'];
$upfileError = $stmp['error'];
}
elseif (isset($_POST['inputfile'])) //輸入目錄或者文件
{
$sourcePath = $_POST['inputfile'];
}
elseif (isset($_POST['decompresssourcefiles'])) //解壓縮提交
{
$isDecompress = $zip->decompress($_POST['decompresssourcefiles'], $_POST['topath']);
if (!empty($isDecompress['filelist']))
{
$href = '<script type="text/javascript" language="javascript">window.location.href=\'#decompress\'</script>';
}

}

$fileList = $zip->fileArray($sourcePath); //解壓縮文件列表

if (isset($_POST['compressinputfileorfolder'])) //壓縮文件目錄或者文件輸入
{
$sourcePath = $_POST['compressinputfileorfolder'];
$href = '<script type="text/javascript" language="javascript">window.location.href=\'#compress\'</script>';
$compressFilelist = $zip->compressFileArray($sourcePath); //壓縮文件列表
}
elseif ((isset($_POST['selectcompressfilelist'])) && (isset($_POST['compresssavefilename'])))
{
$compressFiles = $zip->compress($_POST['selectcompressfilelist'], $_POST['compresssavefilename']); //真實檢測
$isCompress = $zip->CompileZipFile($compressFiles, $zip->savePath, 'all');
if (!empty($isCompress))
{
$href = '<script type="text/javascript" language="javascript">window.location.href=\'#compress\'</script>';
}
}
}

閱讀全文

與php解壓縮文件相關的資料

熱點內容
別樣app海淘怎麼樣 瀏覽:509
聯通app扣費是什麼意思 瀏覽:381
android應用程序管理員許可權 瀏覽:83
石家莊十萬程序員 瀏覽:971
java繼承類實例 瀏覽:286
疫情期間程序員的工資 瀏覽:28
最好的python編譯器 瀏覽:189
安卓手機如何調分屏 瀏覽:731
安卓系統藍牙耳機如何用 瀏覽:721
為什麼微信不能給appstore充值 瀏覽:495
程序員的保護動物 瀏覽:275
程序員遇到問題去哪個網站 瀏覽:531
安卓手機空格鍵連續輸入怎麼取消 瀏覽:520
壓縮空氣管道流量計 瀏覽:564
ug編程高級教程 瀏覽:177
什麼叫做伺服器已滿 瀏覽:37
暑假哪有教演算法的 瀏覽:136
密碼學的根基是加密 瀏覽:662
stata方差檢驗命令 瀏覽:337
解壓後文件夾里的內容丟失 瀏覽:715