PHP Classes

File: example2.php

Recommend this page to a friend!
  Classes of Joshua Townsend   Zip File   example2.php   Download  
File: example2.php
Role: Example script
Content type: text/plain
Description: Example of using class to read a zip file
Class: Zip File
Create and extract ZIP archives in purely in PHP
Author: By
Last change: Made file accessible without user login
Date: 17 years ago
Size: 382 bytes
 

Contents

Class file image Download
<?php
require "zip.class.php"; // Get the zipfile class
$zipfile = new zipfile; // Create an object
$zipfile->read_zip("myzip.zip"); // Read the zip file

// Now, $zipfile->files is an array containing information about the files
// Here is an example of it's use

foreach($zipfile->files as $filea)
{
    echo
"The contents of {$filea['name']}:\n{$file['data']}\n\n";
}
?>