JArchiveZip/create: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 56: | Line 56: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=create | category=create | ||
category=JArchiveZip | category=JArchiveZip | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 00:18, 25 March 2017
Description
Create a ZIP compressed file from an array of file data.
<! removed transcluded page call, red link never existed >
Syntax
create($archive, $files, $options=array())
| Parameter Name | Default Value | Description |
|---|---|---|
| $archive | $archive Path to save archive | |
| $files | $files Array of files to add to archive | |
| $options | array() | $options Compression options [unused] |
Returns
boolean True if successful
Defined in
libraries/joomla/filesystem/archive/zip.php
Importing
jimport( 'joomla.filesystem.archive.zip' );
Source Body
function create($archive, $files, $options = array ())
{
// Initialize variables
$contents = array();
$ctrldir = array();
foreach ($files as $file)
{
$this->_addToZIPFile($file, $contents, $ctrldir);
}
return $this->_createZIPFile($contents, $ctrldir, $archive);
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples