This example describes how PHP reads a ZIP file. Share to everyone for your reference, specific as follows:
<?php
$zip = Zip_open ("111.zip");
if ($zip) {while
($zip _entry = Zip_read ($zip)) {
echo "Name:". Zip_entry_name ($zip _entry). "N";
echo "Actual Filesize:". Zip_entry_filesize ($zip _entry). "N";
echo "Compressed Size:". Zip_entry_compressedsize ($zip _entry). "N";
echo "Compression method:". Zip_entry_compressionmethod ($zip _entry). "N";
if (Zip_entry_open ($zip, $zip _entry, "R")) {
echo "File contents:n";
$buf = Zip_entry_read ($zip _entry, zip_entry_filesize ($zip _entry));
echo "$BUF \ n";
Zip_entry_close ($zip _entry);
echo "n";
}
Zip_close ($zip);
>
The screenshot of the running effect is as follows:
More about PHP Interested readers can view the site topics: "PHP operation zip file and compression skills summary", "PHP file Operation Summary", "PHP Regular Expression Usage summary", "PHP operation and operator Usage Summary", "PHP basic Grammar Introductory Course", " Introduction to PHP object-oriented programming, "PHP string (String) Usage Summary", "Php+mysql Database Operations Introduction Tutorial" and "PHP Common database Operation tips Summary"
I hope this article will help you with the PHP program design.