PhpConcept

Developers Tools

  • Increase font size
  • Default font size
  • Decrease font size
Home PclZip User Guide

PclZip User Guide - PCLZIP_OPT_EXTRACT_AS_STRING

Print PDF

PCLZIP_OPT_EXTRACT_AS_STRING

This argument gives you the ability to extract the content of a file in a string rather than in a file.
It can be used when you just want to get the content of a file without using the filesystem.
For examples :
- displaying a "readme" file,
- directly download the content of a file in the standard output (see also PCLZIP_OPT_EXTRACT_IN_OUTPUT),
- ...

You must be carefull if you extract all the files of your archive in strings. This may exhaust the memory limit of your PHP process.

    $archive = new PclZip('test.zip');
    
$list $archive->extract(PCLZIP_OPT_BY_NAME"data/readme.txt",
                              
PCLZIP_OPT_EXTRACT_AS_STRING);
    if (
$list == 0) {
      echo 
"ERROR : ".$archive->errorInfo(true);
      exit;
    }
    echo 
$list[0]['content']; 

see also PCLZIP_OPT_EXTRACT_IN_OUTPUT

 

[Optional Arguments List]

 

Last Updated on Friday, 18 December 2009 13:13