read_zip_data

Description

Exactly like read_tgz_data except it handles .zip archives instead of .tar.gz archives.

Syntax

string read_zip_data (string $data, string $destination[, bool $single_file[, bool $overwrite]])



Parameter $data

Expected type: String
Description: The raw data for the zip file (opened by read_tgz_file)



Parameter $destination

Expected type: String
Description: Null to return a listing of files in the archive; the actual destination of the files in the archive; the name of a single file to get the contents of (if single_file is true)



Parameter $single_file

Expected type: Boolean
Description: If true, returns the contents of the file specified by destination or false if the file can't be found (default value is false).



Parameter $overwrite

Expected type: Boolean
Description: If true, will overwrite files with newer modication times. Default is false.



Return value

Expected type: String
Description: An array of files in the archive; contents of a file if $single_file is true; false otherwise


Notes

  • Extracts a file or files from the .zip contained in data.
  • If destination is null, returns a list of files in the archive.
  • If single_file is true, returns the contents of the file specified by destination, if it exists, or false.
  • If single_file is true, destination can start with * and / to signify that the file may come from any directory.
  • Destination should not begin with a / if single_file is true.
  • Overwrites existing files with newer modification times if and only if overwrite is true.
  • Creates the destination directory if it doesn't exist, and is specified.
  • Requires zlib support be built into PHP.
  • Returns an array of the files extracted.
Advertisement: