pclzip压缩指定目录,参数郁闷 真的很急求各位大侠,友情帮助一下,小弟不感激解决方法
pclzip压缩指定目录,参数郁闷 真的很急,求各位大侠,友情帮助一下,小弟不感激
pclzip压缩指定目录,比如这个文件放到/data里边,要把整站点儿打包,包里边的路径仅包含当前站点儿文件及目录。
$z = new PclZip(YSROOT.'/data/back_090508.zip');
$result = $z->create('参数');这儿的参数该怎么填呀?
我试过YSROOT,它是把从分区根目录到站点根目录的所有路径都带着了,有点儿多余。
../,我也试过了,解压后是指定目录的上一层,控制起来,不太直观。
真的很急,求各位大侠,友情帮助一下,小弟不感激
------解决方案--------------------
PclZip简介与使用
------解决方案--------------------
这个类我没用过
按他的说明,给他目录名就可以了吧
------解决方案--------------------
- PHP code
//解压缩到extract/folder/这个目录中 [php]$list = $archive->extract(PCLZIP_OPT_PATH, "extract/folder/");[/php] //增加这个目录在压缩文件中,完成以后压缩文件里面会有backup这个目录,backup里面会有这两个文档 [php]$list = $archive->create("file.txt,image.gif",PCLZIP_OPT_ADD_PATH, "backup");[/php] //去掉部份的路径,这里完成后会变成test/file.txt [php]$list = $archive->add("/usr/local/user/test/file.txt",PCLZIP_OPT_REMOVE_PATH, "/usr/local/user");[/php] //把所有路径都去掉,这个压缩文件建立完后,里面就只会有file.txt跟image.gif,不会有目录了 [php]$list = $archive->create("data/file.txt images/image.gif",PCLZIP_OPT_REMOVE_ALL_PATH);[/php] //把解压缩出来的文档的CHMOD设成0777 [php]$list = $archive->extract(PCLZIP_OPT_SET_CHMOD, 0777);[/php] //解压缩的文件列表,可以是数组,如: [php]$rule_list[0] = 'test/aaa.txt'; $rule_list[1] = 'test/ddd.txt';[/php] //或是下面这样,一个字串中,用逗号分隔每个要解压缩的文档 [php]$rule_list = "test/aaa.txt,test/ddd.txt"; $list = $archive->extract(PCLZIP_OPT_BY_NAME,$rule_list);[/php] //解压缩部份的文档,使用php的ereg()函式,文档名称有比对成功的都会被解压缩 [php]$list = $archive->extract(PCLZIP_OPT_BY_EREG, "aa");[/php] //解压缩部份的文档,使用php的preg_match()函式,文档名称有比对成功的都会被解压缩 [php]$list = $archive->extract(PCLZIP_OPT_BY_PREG, "/^bb/");[/php] //上面这两个函式如果不懂的话,请先研究正规表示法(Regular Expression) //依照阵列中元素的索引解压缩,可是我不太懂index啥 ==! [php]$list = $archive->extract(PCLZIP_OPT_BY_INDEX, array('0-1','6-7'));[/php] //将一个文档内容解压缩成一个字串 [php]$list = $archive->extract(PCLZIP_OPT_BY_NAME, "data/readme.txt",PCLZIP_OPT_EXTRACT_AS_STRING);[/php] //将一个文档内容解压缩完后直接输出(echo) [php]$list = $archive->extract(PCLZIP_OPT_BY_NAME, "data/readme.txt",PCLZIP_OPT_EXTRACT_IN_OUTPUT);[/php] //将一个文档加入一个压缩文件中,但不会对此文档压缩 [php]$list = $archive->add("data/file.txt", PCLZIP_OPT_NO_COMPRESSION);[/php] //对此压缩文件增加一个注解,如果原本就有注解的话会被覆盖掉 [php]$list = $archive->create("data", PCLZIP_OPT_COMMENT, "Add a comment");[/php] //对此压缩文件增加一个注解,如果原本就有注解的话会接在后面 [php]$list = $archive->add("data", PCLZIP_OPT_ADD_COMMENT, "Add a comment after the existing one");[/php] //对此压缩文件增加一个注解,如果原本就有注解的话会放在原本的注解前面 [php]$list = $archive->add("data", PCLZIP_OPT_PREPEND_COMMENT, "Add a comment before the existing one");[/php]<div class="clear"> </div>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7
