1. Please download my prepared zip.php tool class, download and unzip, put the files inside the corresponding directory, I was placed in the virtual directory in the Include folder.
2. Add the following code to your PHP file
Copy CodeThe code is as follows:
Require_once "./include/zip.php";
$zip = new Phpzip ();
$zip-
Previous
Using soap to transmit data over the network results in a slow transmission speed due to a large amount of data.To solve this problem, you can zip the file before passing it.Because almost all data is transmitted in the database, the compression space is very large.Tested, it can be compressed to the original 1/15 Method 1: use Java Compres
Parsing an XML file from a zip file The general step is to extract the zip file first, and then parse the XML directly from the zip file to read the input stream from it to reduce the I/O operation. The following is an example of parsing an XML file from a ZIP file:
The
Er, I have reviewed my previous articles today. The highest attention rate is the "self-painted radiobutton". Many people have sent messages to send source code, which is also lazy, now the source code connection has been added to the end of the article, and it is also the download of csdn. I hope it will help some people. Looking at what I wrote before is quite interesting, especially the learning version
For work reasons, a complete zip code database is required. The data on the Internet is relatively old and there is very little data. I really hope the post office can download the zip code for free, or you can have an interface.
Many of my friends will use JDK's built-in zip-related APIs to compress and decompress the zip file. This function is no problem if the zip file is used in full English, but it cannot be used in Chinese, next I will introduce a program that supports Chinese Java compression and decompression zip files.
Apache ant:
Http
PHP + AJAX automatically completes the example: processing the zip code. After the customer enters a POSTCODE, zipcode. PHP receives it, extracts the corresponding data from the data table, and then returns it to the client in a certain format (separated by | ). After the customer enters a POSTCODE, zipcode. PHP receiv
pathName) {ZipFile = new File (pathName);}
public void Compress (String srcpathname) { File srcdir = new file (srcpathname); if (!srcdir.exists ()) Throw The new RuntimeException (Srcpathname + "does not exist.) "); Project PRJ = new Project (); Zip zip = new zip (); Zip.setproject (PRJ); Zip.setdestfile (ZipFile); Fileset fileset = new Fileset (); Fil
installation, you only need to include it when using it again.
For example:
This way
In addition, in the extract part, the files are extracted in order of folders, instead of simply extracting files.
Related usage is like this
The code is as follows:
Require_once ('pclzip. lib. php ');$ Archive = new PclZip('archive.zip ');If ($ archive-> extract () = 0) {/* the decompression path is the same as the original path */Die ("Error:". $ archive-> err
2011-04-01 17:58:52| Category: Android | Report | Font size Subscription How does the unzip function of the zip file be implemented in the Android platform? Because Android has integrated the Zlib library, for the English and non-password zip file decompression is relatively simple, the following Android123 to everyone a zip
Note: This code is a little bug, so you have to use it together ~~ Bug1: If duplicate files exist, a window indicating whether to overwrite the files is displayed on the server. Therefore, do not duplicate the directories when extracting files. Bug2: it is the compression time. Similarly, there should be no duplicate names. In addition, at the beginning, create a zip file, copy it, and add it to it. The ove
accordance with the order of the folder to extract, rather than simply extract the file Eucalyptus out
Related usage like this
Copy Code code as follows:
Require_once (' pclzip.lib.php ');
$archive = new Pclzip (' Archive.zip ');
if ($archive->extract () = = 0) {/* The decompression path is the same path as the original file * *
Die ("Error:". $archive->errorinfo (true));
}
?>
Zip:pclzip http://www.phpconcept.net/pclzip/index.en.php
rar:pecl rar Http://pecl.php.net/package/rar
In the past to perform the decompressor under PHP, the most common way is to write command and then use EXEC () and other execution functions to run
This may be possible under Windows, but switching to UNIX can be a problem for account permissions and cannot be executed successfully
Is there a way of providing a function that can be used directly without having to go to the command to run?
The a
In the actual project code use process, found that if the Java class Library standard specified Gzipinputstream read compressed data decompression does not work stably, the reason is unknown. Instead of using Inflaterinputstream to replace Gzipinputstream stable, normal work, now the Inflaterinputstream-based Zip\gzip Decompression
extract part, the files are extracted in order of folders, instead of simply extracting files.
Related usage is like this
Copy codeThe Code is as follows: Require_once ('pclzip. lib. php ');
$ Archive = new PclZip('archive.zip ');
If ($ archive-> extract () = 0) {/* the decompression path is the same as the original path */
Die ("Error:". $ archive-> errorInfo (true ));
}
?>
You can also specify the decompression path, suchCopy codeThe
Use an open-source Ajax Library: Ajax toybox
Description:When registering or checking out a shopping cart, you need to fill in your personal data. This step can be concise. We only need to fill in the zip code for the guests and then follow the zip code, the database automat
Description: during registration or shopping cart checkout, you need to fill in your personal data. This step can be concise. We only need to fill in the zip code for the guests and then follow the zip code, the database automatically retrieves the corresponding province, ci
Ajax
Description:
In the registration or shopping cart checkout, users need to fill in personal data, this link can be concise, we need only guests fill in the ZIP code, and then according to this zip code, automatically from the database to remove the corresponding provinci
accordance with the order of the folder to extract, rather than simply extract the file Eucalyptus out
Related usage like this
Copy CodeThe code is as follows:
Require_once (' pclzip.lib.php ');
$archive = new Pclzip (' Archive.zip ');
if ($archive->extract () = = 0) {/* The decompression path is the same path as the original file * *
Die ("Error:". $archive->errorinfo (true));
}
?>
Of course, you can also specify the decompression path, like this
Apache Ant Download Address:
http://ant.apache.org/bindownload.cgi
Put the Lib/ant.jar into the build path of our project, only need Ant.jar. In fact, Ant's Zip API is very similar to JDK's, if it was written in JDK's API, basically, just change the top import package.
The code is as follows
Copy Code
Package common;Import Java.io.B
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.