Home > PHP > Function > > ZipArchive::addFromString()

ZipArchive::addFromString()

ZipArchive::addFromString - Add a file to a ZIP archive using its contents

Syntax

bool ZipArchive::addFromString (string $localname, string $contents)

Arguments

  • localname - The name of the entry to create.
  • contents - The contents to use to create the entry. It is used in a binary safe mode.

Description

Add a file to a ZIP archive using its contents.

Version

PHP 5.2.0, PECL zip >= 1.1.0

Return value

Returns TRUE on success or FALSE on failure.