- 浏览: 416244 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
u010620626:
foreach是最快的,因为php的array内部元素之间有指 ...
[流言终结者] PHP for / foreach / while 性能比较 -
ostrich_sun:
谢楼主
Sybase PowerDesigner 12.5 破解补丁/序列号/注册码 -
xuxueqin29:
为什么我这边用不上
Sybase PowerDesigner 12.5 破解补丁/序列号/注册码 -
sdpfoue:
http://www.php-internals.com/bo ...
[流言终结者] PHP for / foreach / while 性能比较 -
nakupanda:
lovelease 写道nakupanda 写道你应该去阅读一 ...
java调用microsoft translate api webservice
一个简单的用法:
$filename= "product_images.zip"; $test = new zip_file($filename); $test->set_options(array('inmemory' => 0, 'recurse' => 0, 'storepaths' => 0)); $test->add_files("images_package/*.jpg"); $test->create_archive();
<?php /*-------------------------------------------------- | TAR/GZIP/BZIP2/ZIP ARCHIVE CLASSES 2.1 | By Devin Doucette | Copyright (c) 2005 Devin Doucette | Email: darksnoopy@shaw.ca +-------------------------------------------------- | Email bugs/suggestions to darksnoopy@shaw.ca +-------------------------------------------------- | This script has been created and released under | the GNU GPL and is free to use and redistribute | only if this copyright statement is not removed +--------------------------------------------------*/ class archive { function archive($name) { $this->options = array ( 'basedir' => ".", 'name' => $name, 'prepend' => "", 'inmemory' => 0, 'overwrite' => 0, 'recurse' => 1, 'storepaths' => 1, 'followlinks' => 0, 'level' => 3, 'method' => 1, 'sfx' => "", 'type' => "", 'comment' => "" ); $this->files = array (); $this->exclude = array (); $this->storeonly = array (); $this->error = array (); } function set_options($options) { foreach ($options as $key => $value) $this->options[$key] = $value; if (!empty ($this->options['basedir'])) { $this->options['basedir'] = str_replace("\\", "/", $this->options['basedir']); $this->options['basedir'] = preg_replace("/\/+/", "/", $this->options['basedir']); $this->options['basedir'] = preg_replace("/\/$/", "", $this->options['basedir']); } if (!empty ($this->options['name'])) { $this->options['name'] = str_replace("\\", "/", $this->options['name']); $this->options['name'] = preg_replace("/\/+/", "/", $this->options['name']); } if (!empty ($this->options['prepend'])) { $this->options['prepend'] = str_replace("\\", "/", $this->options['prepend']); $this->options['prepend'] = preg_replace("/^(\.*\/+)+/", "", $this->options['prepend']); $this->options['prepend'] = preg_replace("/\/+/", "/", $this->options['prepend']); $this->options['prepend'] = preg_replace("/\/$/", "", $this->options['prepend']) . "/"; } } function create_archive() { $this->make_list(); if ($this->options['inmemory'] == 0) { $pwd = getcwd(); chdir($this->options['basedir']); if ($this->options['overwrite'] == 0 && file_exists($this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip" ? ".tmp" : ""))) { $this->error[] = "File {$this->options['name']} already exists."; chdir($pwd); return 0; } else if ($this->archive = @fopen($this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip" ? ".tmp" : ""), "wb+")) chdir($pwd); else { $this->error[] = "Could not open {$this->options['name']} for writing."; chdir($pwd); return 0; } } else $this->archive = ""; switch ($this->options['type']) { case "zip": if (!$this->create_zip()) { $this->error[] = "Could not create zip file."; return 0; } break; case "bzip": if (!$this->create_tar()) { $this->error[] = "Could not create tar file."; return 0; } if (!$this->create_bzip()) { $this->error[] = "Could not create bzip2 file."; return 0; } break; case "gzip": if (!$this->create_tar()) { $this->error[] = "Could not create tar file."; return 0; } if (!$this->create_gzip()) { $this->error[] = "Could not create gzip file."; return 0; } break; case "tar": if (!$this->create_tar()) { $this->error[] = "Could not create tar file."; return 0; } } if ($this->options['inmemory'] == 0) { fclose($this->archive); if ($this->options['type'] == "gzip" || $this->options['type'] == "bzip") unlink($this->options['basedir'] . "/" . $this->options['name'] . ".tmp"); } } function add_data($data) { if ($this->options['inmemory'] == 0) fwrite($this->archive, $data); else $this->archive .= $data; } function make_list() { if (!empty ($this->exclude)) foreach ($this->files as $key => $value) foreach ($this->exclude as $current) if ($value['name'] == $current['name']) unset ($this->files[$key]); if (!empty ($this->storeonly)) foreach ($this->files as $key => $value) foreach ($this->storeonly as $current) if ($value['name'] == $current['name']) $this->files[$key]['method'] = 0; unset ($this->exclude, $this->storeonly); } function add_files($list) { $temp = $this->list_files($list); foreach ($temp as $current) $this->files[] = $current; } function exclude_files($list) { $temp = $this->list_files($list); foreach ($temp as $current) $this->exclude[] = $current; } function store_files($list) { $temp = $this->list_files($list); foreach ($temp as $current) $this->storeonly[] = $current; } function list_files($list) { if (!is_array ($list)) { $temp = $list; $list = array ($temp); unset ($temp); } $files = array (); $pwd = getcwd(); chdir($this->options['basedir']); foreach ($list as $current) { $current = str_replace("\\", "/", $current); $current = preg_replace("/\/+/", "/", $current); $current = preg_replace("/\/$/", "", $current); if (strstr($current, "*")) { $regex = preg_replace("/([\\\^\$\.\[\]\|\(\)\?\+\{\}\/])/", "\\\\\\1", $current); $regex = str_replace("*", ".*", $regex); $dir = strstr($current, "/") ? substr($current, 0, strrpos($current, "/")) : "."; $temp = $this->parse_dir($dir); foreach ($temp as $current2) if (preg_match("/^{$regex}$/i", $current2['name'])) $files[] = $current2; unset ($regex, $dir, $temp, $current); } else if (@is_dir($current)) { echo "dir"; $temp = $this->parse_dir($current); foreach ($temp as $file) $files[] = $file; unset ($temp, $file); } else if (@file_exists($current)) $files[] = array ('name' => $current, 'name2' => $this->options['prepend'] . preg_replace("/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr($current, "/")) ? substr($current, strrpos($current, "/") + 1) : $current), 'type' => @is_link($current) && $this->options['followlinks'] == 0 ? 2 : 0, 'ext' => substr($current, strrpos($current, ".")), 'stat' => stat($current)); else { echo "other error "; } } chdir($pwd); unset ($current, $pwd); usort($files, array ("archive", "sort_files")); //prt($files); //die; return $files; } function parse_dir($dirname) { if ($this->options['storepaths'] == 1 && !preg_match("/^(\.+\/*)+$/", $dirname)) $files = array (array ('name' => $dirname, 'name2' => $this->options['prepend'] . preg_replace("/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr($dirname, "/")) ? substr($dirname, strrpos($dirname, "/") + 1) : $dirname), 'type' => 5, 'stat' => stat($dirname))); else $files = array (); $dir = @opendir($dirname); while ($file = @readdir($dir)) { $fullname = $dirname . "/" . $file; if ($file == "." || $file == "..") continue; else if (@is_dir($fullname)) { if (empty ($this->options['recurse'])) continue; $temp = $this->parse_dir($fullname); foreach ($temp as $file2) $files[] = $file2; } else if (@file_exists($fullname)) $files[] = array ('name' => $fullname, 'name2' => $this->options['prepend'] . preg_replace("/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr($fullname, "/")) ? substr($fullname, strrpos($fullname, "/") + 1) : $fullname), 'type' => @is_link($fullname) && $this->options['followlinks'] == 0 ? 2 : 0, 'ext' => substr($file, strrpos($file, ".")), 'stat' => stat($fullname)); } @closedir($dir); return $files; } function sort_files($a, $b) { if ($a['type'] != $b['type']) if ($a['type'] == 5 || $b['type'] == 2) return -1; else if ($a['type'] == 2 || $b['type'] == 5) return 1; else if ($a['type'] == 5) return strcmp(strtolower($a['name']), strtolower($b['name'])); else if ($a['ext'] != $b['ext']) return strcmp($a['ext'], $b['ext']); else if ($a['stat'][7] != $b['stat'][7]) return $a['stat'][7] > $b['stat'][7] ? -1 : 1; else return strcmp(strtolower($a['name']), strtolower($b['name'])); return 0; } function download_file() { if ($this->options['inmemory'] == 0) { $this->error[] = "Can only use download_file() if archive is in memory. Redirect to file otherwise, it is faster."; return; } switch ($this->options['type']) { case "zip": header("Content-Type: application/zip"); break; case "bzip": header("Content-Type: application/x-bzip2"); break; case "gzip": header("Content-Type: application/x-gzip"); break; case "tar": header("Content-Type: application/x-tar"); } $header = "Content-Disposition: attachment; filename=\""; $header .= strstr($this->options['name'], "/") ? substr($this->options['name'], strrpos($this->options['name'], "/") + 1) : $this->options['name']; $header .= "\""; header($header); header("Content-Length: " . strlen($this->archive)); header("Content-Transfer-Encoding: binary"); header("Cache-Control: no-cache, must-revalidate, max-age=60"); header("Expires: Sat, 01 Jan 2000 12:00:00 GMT"); print($this->archive); } } class tar_file extends archive { function tar_file($name) { $this->archive($name); $this->options['type'] = "tar"; } function create_tar() { $pwd = getcwd(); chdir($this->options['basedir']); foreach ($this->files as $current) { if ($current['name'] == $this->options['name']) continue; if (strlen($current['name2']) > 99) { $path = substr($current['name2'], 0, strpos($current['name2'], "/", strlen($current['name2']) - 100) + 1); $current['name2'] = substr($current['name2'], strlen($path)); if (strlen($path) > 154 || strlen($current['name2']) > 99) { $this->error[] = "Could not add {$path}{$current['name2']} to archive because the filename is too long."; continue; } } $block = pack("a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12", $current['name2'], sprintf("%07o", $current['stat'][2]), sprintf("%07o", $current['stat'][4]), sprintf("%07o", $current['stat'][5]), sprintf("%011o", $current['type'] == 2 ? 0 : $current['stat'][7]), sprintf("%011o", $current['stat'][9]), " ", $current['type'], $current['type'] == 2 ? @readlink($current['name']) : "", "ustar ", " ", "Unknown", "Unknown", "", "", !empty ($path) ? $path : "", ""); $checksum = 0; for ($i = 0; $i < 512; $i++) $checksum += ord(substr($block, $i, 1)); $checksum = pack("a8", sprintf("%07o", $checksum)); $block = substr_replace($block, $checksum, 148, 8); if ($current['type'] == 2 || $current['stat'][7] == 0) $this->add_data($block); else if ($fp = @fopen($current['name'], "rb")) { $this->add_data($block); while ($temp = fread($fp, 1048576)) $this->add_data($temp); if ($current['stat'][7] % 512 > 0) { $temp = ""; for ($i = 0; $i < 512 - $current['stat'][7] % 512; $i++) $temp .= "\0"; $this->add_data($temp); } fclose($fp); } else $this->error[] = "Could not open file {$current['name']} for reading. It was not added."; } $this->add_data(pack("a1024", "")); chdir($pwd); return 1; } function extract_files() { $pwd = getcwd(); chdir($this->options['basedir']); if ($fp = $this->open_archive()) { if ($this->options['inmemory'] == 1) $this->files = array (); while ($block = fread($fp, 512)) { $temp = unpack("a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp", $block); $file = array ( 'name' => $temp['prefix'] . $temp['name'], 'stat' => array ( 2 => $temp['mode'], 4 => octdec($temp['uid']), 5 => octdec($temp['gid']), 7 => octdec($temp['size']), 9 => octdec($temp['mtime']), ), 'checksum' => octdec($temp['checksum']), 'type' => $temp['type'], 'magic' => $temp['magic'], ); if ($file['checksum'] == 0x00000000) break; else if (substr($file['magic'], 0, 5) != "ustar") { $this->error[] = "This script does not support extracting this type of tar file."; break; } $block = substr_replace($block, " ", 148, 8); $checksum = 0; for ($i = 0; $i < 512; $i++) $checksum += ord(substr($block, $i, 1)); if ($file['checksum'] != $checksum) $this->error[] = "Could not extract from {$this->options['name']}, it is corrupt."; if ($this->options['inmemory'] == 1) { $file['data'] = fread($fp, $file['stat'][7]); fread($fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512)); unset ($file['checksum'], $file['magic']); $this->files[] = $file; } else if ($file['type'] == 5) { if (!is_dir($file['name'])) mkdir($file['name'], $file['stat'][2]); } else if ($this->options['overwrite'] == 0 && file_exists($file['name'])) { $this->error[] = "{$file['name']} already exists."; continue; } else if ($file['type'] == 2) { symlink($temp['symlink'], $file['name']); chmod($file['name'], $file['stat'][2]); } else if ($new = @fopen($file['name'], "wb")) { fwrite($new, fread($fp, $file['stat'][7])); fread($fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512)); fclose($new); chmod($file['name'], $file['stat'][2]); } else { $this->error[] = "Could not open {$file['name']} for writing."; continue; } chown($file['name'], $file['stat'][4]); chgrp($file['name'], $file['stat'][5]); touch($file['name'], $file['stat'][9]); unset ($file); } } else $this->error[] = "Could not open file {$this->options['name']}"; chdir($pwd); } function open_archive() { return @fopen($this->options['name'], "rb"); } } class gzip_file extends tar_file { function gzip_file($name) { $this->tar_file($name); $this->options['type'] = "gzip"; } function create_gzip() { if ($this->options['inmemory'] == 0) { $pwd = getcwd(); chdir($this->options['basedir']); if ($fp = gzopen($this->options['name'], "wb{$this->options['level']}")) { fseek($this->archive, 0); while ($temp = fread($this->archive, 1048576)) gzwrite($fp, $temp); gzclose($fp); chdir($pwd); } else { $this->error[] = "Could not open {$this->options['name']} for writing."; chdir($pwd); return 0; } } else $this->archive = gzencode($this->archive, $this->options['level']); return 1; } function open_archive() { return @gzopen($this->options['name'], "rb"); } } class bzip_file extends tar_file { function bzip_file($name) { $this->tar_file($name); $this->options['type'] = "bzip"; } function create_bzip() { if ($this->options['inmemory'] == 0) { $pwd = getcwd(); chdir($this->options['basedir']); if ($fp = bzopen($this->options['name'], "wb")) { fseek($this->archive, 0); while ($temp = fread($this->archive, 1048576)) bzwrite($fp, $temp); bzclose($fp); chdir($pwd); } else { $this->error[] = "Could not open {$this->options['name']} for writing."; chdir($pwd); return 0; } } else $this->archive = bzcompress($this->archive, $this->options['level']); return 1; } function open_archive() { return @bzopen($this->options['name'], "rb"); } } class zip_file extends archive { function zip_file($name) { $this->archive($name); $this->options['type'] = "zip"; } function create_zip() { $files = 0; $offset = 0; $central = ""; if (!empty ($this->options['sfx'])) if ($fp = @fopen($this->options['sfx'], "rb")) { $temp = fread($fp, filesize($this->options['sfx'])); fclose($fp); $this->add_data($temp); $offset += strlen($temp); unset ($temp); } else $this->error[] = "Could not open sfx module from {$this->options['sfx']}."; $pwd = getcwd(); chdir($this->options['basedir']); foreach ($this->files as $current) { if ($current['name'] == $this->options['name']) continue; $timedate = explode(" ", date("Y n j G i s", $current['stat'][9])); $timedate = ($timedate[0] - 1980 << 25) | ($timedate[1] << 21) | ($timedate[2] << 16) | ($timedate[3] << 11) | ($timedate[4] << 5) | ($timedate[5]); $block = pack("VvvvV", 0x04034b50, 0x000A, 0x0000, (isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate); if ($current['stat'][7] == 0 && $current['type'] == 5) { $block .= pack("VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']) + 1, 0x0000); $block .= $current['name2'] . "/"; $this->add_data($block); $central .= pack("VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']) + 1, 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset); $central .= $current['name2'] . "/"; $files++; $offset += (31 + strlen($current['name2'])); } else if ($current['stat'][7] == 0) { $block .= pack("VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']), 0x0000); $block .= $current['name2']; $this->add_data($block); $central .= pack("VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']), 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset); $central .= $current['name2']; $files++; $offset += (30 + strlen($current['name2'])); } else if ($fp = @fopen($current['name'], "rb")) { $temp = fread($fp, $current['stat'][7]); fclose($fp); $crc32 = crc32($temp); if (!isset($current['method']) && $this->options['method'] == 1) { $temp = gzcompress($temp, $this->options['level']); $size = strlen($temp) - 6; $temp = substr($temp, 2, $size); } else $size = strlen($temp); $block .= pack("VVVvv", $crc32, $size, $current['stat'][7], strlen($current['name2']), 0x0000); $block .= $current['name2']; $this->add_data($block); $this->add_data($temp); unset ($temp); $central .= pack("VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, $crc32, $size, $current['stat'][7], strlen($current['name2']), 0x0000, 0x0000, 0x0000, 0x0000, 0x00000000, $offset); $central .= $current['name2']; $files++; $offset += (30 + strlen($current['name2']) + $size); } else $this->error[] = "Could not open file {$current['name']} for reading. It was not added."; } $this->add_data($central); $this->add_data(pack("VvvvvVVv", 0x06054b50, 0x0000, 0x0000, $files, $files, strlen($central), $offset, !empty ($this->options['comment']) ? strlen($this->options['comment']) : 0x0000)); if (!empty ($this->options['comment'])) $this->add_data($this->options['comment']); chdir($pwd); return 1; } } ?>
发表评论
-
Discuz7.2 发贴API
2010-10-28 16:37 1396实现远程向DISCUZ7.2 POST数据 接受参数: ... -
从DISCUZ中拿出来的UBBCODE函数
2010-10-18 18:58 1543<?php /* 从Discuz7.2中分离出来的UB ... -
将XML转为数组结构的函数
2009-09-08 11:37 1862此方法要求传入一个节点(DOMNode),返回该节点下的所以子 ... -
记录表单数据的函数
2009-09-02 00:28 1262//保存表单数据到cookies函数 functio ... -
PHP在程序中关闭魔术引号
2009-08-31 17:20 1467if (ENABLEMQG=='0'&&g ... -
一个简单易用的PHP分页类
2009-08-20 16:35 3159使用实例: $sql = "select * f ... -
UCENTER的密码加密方式
2009-07-29 09:05 2094md5(concat(md5('密码'),salt)) -
PHP获取远程页面的数据
2009-06-30 11:10 1258$html = file_get_contents('http ... -
一个计算页面执行时间的简单类
2009-06-02 16:56 1273以后可能会扩充些实用的功能 用法: <?php ... -
一个记录用户访问页面的类,顺便记一下PHP4的重载方式
2009-05-27 11:13 1341当用户浏览某页面时需要转向到注册页面,注册完成后希望用户能返回 ... -
一个简单的数据库类
2009-05-25 16:21 1072<?php /* * @author badb ... -
PHP constant函数取常量值
2009-05-05 15:33 1219constant()函数返回了一个常量值。 -
将数组转为以指定字符分隔的字符串
2009-03-30 00:13 1403implode(splitor,array)
相关推荐
php 的zip压缩类 可实现zip压缩和解压功能强大;亲测没有bug
在本篇介绍中,我们将深入了解一个PHP ZIP压缩类的设计和实现方法。在PHP开发中,经常会有文件压缩的需求,尤其是在需要打包多个文件为ZIP或RAR格式以便于存储、传输或下载时。为此,我们可以使用PHP ZIP压缩类来...
介绍了php文件压缩之PHPZip类用法,实例分析了PHPZip类的定义与相关使用技巧 要使用该PHP扩展类,需要(PHP 5 >= 5.2.0, PECL zip >= 1.1.0),部分方法需要 PHP 5.2. ,且php.ini配置支持zip 对于win系统,直接...
在PHP中生成ZIP压缩文件...总的来说,PHP生成ZIP压缩文件的核心在于`ZipArchive`类,通过熟练掌握其方法和属性,可以灵活地完成各种压缩任务。结合适当的错误处理和优化,我们可以创建出高效、可靠的文件压缩解决方案。
3. **zip**:zip是一种常用的文件压缩格式,PHP中的`ZipArchive`类提供了对zip文件的处理,包括添加、删除、列出和提取文件。例如,你可以创建一个新的`ZipArchive`对象,然后调用`open()`方法打开或创建一个zip文件...
介绍了php文件压缩之PHPZip类用法,实例分析了PHPZip类的定义与相关使用技巧 要使用该PHP扩展类,需要(PHP 5 >= 5.2.0, PECL zip >= 1.1.0),部分方法需要 PHP 5.2.+,且php.ini配置支持zip 对于win系统,直接去掉...
本文将深入探讨如何使用PHP实现在线压缩代码,以及与ZIP压缩格式相关的技术知识。 首先,我们要理解PHP如何处理文件和目录操作。PHP提供了丰富的文件系统函数,如`scandir()`用于列出目录中的所有文件,`file_put_...
在PHP编程中,`ZipArchive` 是一个非常实用的类,用于处理ZIP格式的压缩文件。这个类提供了创建、读取、修改以及提取ZIP文件的能力,同时也支持其他压缩格式如TAR和GZIP。在本文中,我们将深入探讨`ZipArchive` 类的...
第一个文件名“zip压缩成zip”可能是一个实现ZIP文件创建的类,它可能包含以下功能: 1. 添加文件到ZIP:类库可能提供一个方法,允许开发者传入文件路径,将其添加到ZIP档案中。 2. 添加目录:除了单个文件,类库还...
第一个源码文件可能是"zip压缩类",它的主要功能是实现文件或目录的压缩。这个类通常会包含如`addFile()`、`createFromDirectory()`等方法,用于将单个文件或整个目录添加到ZIP文件中。同时,它可能会提供`...
这个系统压缩类提供了高效且灵活的方法,能够帮助开发者将一组文件快速打包成ZIP或RAR格式的压缩包,同时允许用户自定义压缩文件的后缀名。下面将详细解释`phpzip`类的主要特性和使用方法。 1. **安装和引入**: ...
在PHP中,处理压缩文件,特别是ZIP格式的文件,可以借助内置的ZipArchive类。这个类提供了丰富的功能,包括创建、打开、修改和提取ZIP文件。在这个特定的资源"php的压缩与解压Zip类.zip"中,我们可能找到了一个经过...
"php文件在线压缩程序类.zip"这个资源提供了一个用PHP编写的文件在线压缩类库,它利用了PHP自身提供的压缩功能,而不是依赖于像RAR这样的第三方库,这使得程序更加轻便且易于部署。 该压缩程序类库的工作原理基于...
### PHP压缩ZIP文件知识点 #### 一、PHP与ZIP文件操作简介 在PHP开发中,经常需要对文件进行压缩操作,...综上所述,利用PHP内置的`ZipArchive`类可以方便地实现文件的压缩功能,适用于多种场景下的文件管理需求。
总结,PHP在线解压压缩ZIP工具利用了`ZipArchive`类提供的功能,实现了便捷的文件打包和解包服务。在开发这样的工具时,需要注意安全、性能、用户体验等多个方面,以确保功能的稳定性和实用性。
本程序可以快速的实现把我们的文件利用php压缩类压缩成我们想的zip,或者rar 的压缩包,后缀名可以自定义,压缩算法是来自国外一个网站,首先实例化,然后传参,两个参数,第一个关于文件地址的一个Array,第二个是要保存的...
PHP 自带 ZIP 压缩、解压缩类 ZipArchiv 用法指南 PHP 自带 ZIP 压缩、解压缩类 ZipArchiv 是 PHP 语言中的一个内置类,用于实现 ZIP 文件的压缩和解压缩操作。该类提供了多种方法来操作 ZIP 文件,例如压缩文件、...
php的压缩解压缩类,很实用,而且不会乱码。支持中文解压缩。
综上所述,PHP结合第三方库如PHPSpreadsheet,可以轻松生成包含图片的Excel文件,而内置的`ZipArchive`类则能帮助我们创建ZIP压缩文件。这两个功能在数据处理和文件打包方面有着广泛的应用。在实际项目中,根据具体...
下载到本地之后,上传PHPZip.php文件到你的服务器上,对其进行访问。 默认密码:xibo123 修改密码方法:在地址栏访问你服务器上PHPZip.php文件,在其后面加上?pwd=密码代码 – 回车。 如以下格式: ...