- 论坛徽章:
- 0
|
利用Pear类库的Archive_Zip类可以很方便的完成文件的压缩,例子如下:
$obj = new Archive_Zip('test.zip'); // name of zip file
$files = array('picsour/1-txt-1.psd',
'picsour/txt-6.psd',
'picsour/txt-6-1.psd'); // files to store
if ($obj->create($files)) {
echo 'Created successfully!';
} else {
echo 'Error in file creation';
}
$files = $obj->listContent(); // array of file information
foreach ($files as $f) {
foreach ($f as $k => $v) {
echo "$k: $v\n" ."
";
}
echo "\n";
}
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/32889/showart_333230.html |
|