mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 17:08:54 +00:00

removing the others git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@78562 c90b9560-bf6c-de11-be94-00142212c4b1
403 lines
13 KiB
XML
403 lines
13 KiB
XML
<!-- D O N O T E D I T T H I S F I L E ! ! !
|
|
|
|
it is still here for historical reasons only
|
|
(as translators may need to check old revision diffs)
|
|
|
|
if you want to change things documented in this file
|
|
you should now edit the files found under en/reference
|
|
instead -->
|
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.19 $ -->
|
|
<reference id="ref.zip">
|
|
<title>Zip File Functions (Read Only Access)</title>
|
|
<titleabbrev>Zip</titleabbrev>
|
|
<partintro>
|
|
<para>
|
|
This module uses the functions of the <ulink
|
|
url="&url.zziplib;">ZZIPlib</ulink> library by Guido Draheim to
|
|
transparently read ZIP compressed archives and the files inside
|
|
them.
|
|
</para>
|
|
<para>
|
|
Please note that ZZIPlib only provides a subset of functions
|
|
provided in a full implementation of the ZIP compression algorithm
|
|
and can only read ZIP file archives. A normal ZIP utility is
|
|
needed to create the ZIP file archives read by this library.
|
|
</para>
|
|
<para>
|
|
Zip support in PHP is not enabled by default. You will need to
|
|
use the <link
|
|
linkend="install.configure.with-zip">--with-zip</link>
|
|
configuration option when compiling PHP to enable zip
|
|
support. This module requires ZZIPlib version >= 0.10.6.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Zip support before PHP 4.1.0 is experimental. This section
|
|
reflects the Zip extension as it exists in PHP 4.1.0 and later.
|
|
</para>
|
|
</note>
|
|
|
|
<sect1 id="zip-example">
|
|
<title>Example Usage</title>
|
|
<para>
|
|
This example opens a ZIP file archive, reads each file in the
|
|
archive and prints out its contents. The
|
|
<filename>test2.zip</filename> archive used in this example is
|
|
one of the test archives in the ZZIPlib source distribution.
|
|
</para>
|
|
<example>
|
|
<title>Zip Usage Example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$zip = zip_open("/tmp/test2.zip");
|
|
|
|
if ($zip) {
|
|
|
|
while ($zip_entry = zip_read($zip)) {
|
|
echo "Name: " . zip_entry_name($zip_entry) . "\n";
|
|
echo "Actual Filesize: " . zip_entry_filesize($zip_entry) . "\n";
|
|
echo "Compressed Size: " . zip_entry_compressedsize($zip_entry) . "\n";
|
|
echo "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "\n";
|
|
|
|
if (zip_entry_open($zip, $zip_entry, "r")) {
|
|
echo "File Contents:\n";
|
|
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
|
|
echo "$buf\n";
|
|
|
|
zip_entry_close($zip_entry);
|
|
}
|
|
echo "\n";
|
|
|
|
}
|
|
|
|
zip_close($zip);
|
|
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</sect1>
|
|
</partintro>
|
|
|
|
<refentry id="function.zip-close">
|
|
<refnamediv>
|
|
<refname>zip_close</refname>
|
|
<refpurpose>Close a Zip File Archive</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>zip_close</methodname>
|
|
<methodparam><type>resource</type><parameter>zip</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Closes a zip file archive. The parameter
|
|
<parameter>zip</parameter> must be a zip archive previously
|
|
opened by <function>zip_open</function>.
|
|
</para>
|
|
<para>
|
|
This function has no return value.
|
|
</para>
|
|
<para>
|
|
See also <function>zip_open</function> and
|
|
<function>zip_read</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.zip-entry-close">
|
|
<refnamediv>
|
|
<refname>zip_entry_close</refname>
|
|
<refpurpose>Close a Directory Entry</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>zip_entry_close</methodname>
|
|
<methodparam><type>resource</type><parameter>zip_entry</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Closes a directory entry specified by
|
|
<parameter>zip_entry</parameter>. The parameter
|
|
<parameter>zip_entry</parameter> must be a valid directory entry
|
|
opened by <function>zip_entry_open</function>.
|
|
</para>
|
|
<para>
|
|
This function has no return value.
|
|
</para>
|
|
<para>
|
|
See also <function>zip_entry_open</function> and
|
|
<function>zip_entry_read</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.zip-entry-compressedsize">
|
|
<refnamediv>
|
|
<refname>zip_entry_compressedsize</refname>
|
|
<refpurpose>Retrieve the Compressed Size of a Directory Entry</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>zip_entry_compressedsize</methodname>
|
|
<methodparam><type>resource</type><parameter>zip_entry</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the compressed size of the directory entry specified by
|
|
<parameter>zip_entry</parameter>. The parameter
|
|
<parameter>zip_entry</parameter> is a valid directory entry
|
|
returned by <function>zip_read</function>.
|
|
</para>
|
|
<para>
|
|
See also <function>zip_open</function> and
|
|
<function>zip_read</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.zip-entry-compressionmethod">
|
|
<refnamediv>
|
|
<refname>zip_entry_compressionmethod</refname>
|
|
<refpurpose>Retrieve the Compression Method of a Directory Entry</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>zip_entry_compressionmethod</methodname>
|
|
<methodparam><type>resource</type><parameter>zip_entry</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the compression method of the directory entry specified
|
|
by <parameter>zip_entry</parameter>. The parameter
|
|
<parameter>zip_entry</parameter> is a valid directory entry
|
|
returned by <function>zip_read</function>.
|
|
</para>
|
|
<para>
|
|
See also <function>zip_open</function> and
|
|
<function>zip_read</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.zip-entry-filesize">
|
|
<refnamediv>
|
|
<refname>zip_entry_filesize</refname>
|
|
<refpurpose>Retrieve the Actual File Size of a Directory Entry</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>zip_entry_filesize</methodname>
|
|
<methodparam><type>resource</type><parameter>zip_entry</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the actual size of the directory entry specified by
|
|
<parameter>zip_entry</parameter>. The parameter
|
|
<parameter>zip_entry</parameter> is a valid directory entry
|
|
returned by <function>zip_read</function>.
|
|
</para>
|
|
<para>
|
|
See also <function>zip_open</function> and
|
|
<function>zip_read</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.zip-entry-name">
|
|
<refnamediv>
|
|
<refname>zip_entry_name</refname>
|
|
<refpurpose>Retrieve the Name of a Directory Entry</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>zip_entry_name</methodname>
|
|
<methodparam><type>resource</type><parameter>zip_entry</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the name of the directory entry specified by
|
|
<parameter>zip_entry</parameter>. The parameter
|
|
<parameter>zip_entry</parameter> is a valid directory entry
|
|
returned by <function>zip_read</function>.
|
|
</para>
|
|
<para>
|
|
See also <function>zip_open</function> and
|
|
<function>zip_read</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.zip-entry-open">
|
|
<refnamediv>
|
|
<refname>zip_entry_open</refname>
|
|
<refpurpose>Open a Directory Entry for Reading</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>zip_entry_open</methodname>
|
|
<methodparam><type>resource</type><parameter>zip</parameter></methodparam>
|
|
<methodparam><type>resource</type><parameter>zip_entry</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>mode</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Opens a directory entry in a zip file for reading. The parameter
|
|
<parameter>zip</parameter> is a valid resource handle returned by
|
|
<function>zip_open</function>. The parameter
|
|
<parameter>zip_entry</parameter> is a directory entry resource
|
|
returned by <function>zip_read</function>. The optional
|
|
parameter <parameter>mode</parameter> can be any of the modes
|
|
specified in the documentaion for <function>fopen</function>.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Currently, <parameter>mode</parameter> is ignored and is always
|
|
<literal>"rb"</literal>. This is due to the fact that zip
|
|
support in PHP is read only access. Please see
|
|
<function>fopen</function> for an explanation of various modes,
|
|
including <literal>"rb"</literal>.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Unlike <function>fopen</function> and other similar functions,
|
|
the return value of <function>zip_entry_open</function> only
|
|
indicates the result of the operation and is not needed for
|
|
reading or closing the directory entry.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
See also <function>zip_entry_read</function> and
|
|
<function>zip_entry_close</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.zip-entry-read">
|
|
<refnamediv>
|
|
<refname>zip_entry_read</refname>
|
|
<refpurpose>Read From an Open Directory Entry</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>zip_entry_read</methodname>
|
|
<methodparam><type>resource</type><parameter>zip_entry</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Reads up to <parameter>length</parameter> bytes from an open
|
|
directory entry. If <parameter>length</parameter> is not
|
|
specified, then <function>zip_entry_read</function> will attempt
|
|
to read 1024 bytes. The parameter
|
|
<parameter>zip_entry</parameter> is a valid directory entry
|
|
returned by <function>zip_read</function>.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
The <parameter>length</parameter> parameter should be the
|
|
uncompressed length you wish to read.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
Returns the data read, or &false; if the end of the file is
|
|
reached.
|
|
</para>
|
|
<para>
|
|
See also <function>zip_entry_open</function>,
|
|
<function>zip_entry_close</function> and
|
|
<function>zip_entry_filesize</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.zip-open">
|
|
<refnamediv>
|
|
<refname>zip_open</refname>
|
|
<refpurpose>Open a Zip File Archive</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>resource</type><methodname>zip_open</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Opens a new zip archive for reading. The
|
|
<parameter>filename</parameter> parameter is the filename of the
|
|
zip archive to open.
|
|
</para>
|
|
<para>
|
|
Returns a resource handle for later use with
|
|
<function>zip_read</function> and <function>zip_close</function>
|
|
or returns &false; if <parameter>filename</parameter> does not
|
|
exist.
|
|
</para>
|
|
<para>
|
|
See also <function>zip_read</function> and
|
|
<function>zip_close</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.zip-read">
|
|
<refnamediv>
|
|
<refname>zip_read</refname>
|
|
<refpurpose>Read Next Entry in a Zip File Archive</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>resource</type><methodname>zip_read</methodname>
|
|
<methodparam><type>resource</type><parameter>zip</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Reads the next entry in a zip file archive. The parameter
|
|
<parameter>zip</parameter> must be a zip archive previously
|
|
opened by <function>zip_open</function>.
|
|
</para>
|
|
<para>
|
|
Returns a directory entry resource for later use with the
|
|
<function>zip_entry_...</function> functions.
|
|
</para>
|
|
<para>
|
|
See also <function>zip_open</function>,
|
|
<function>zip_close</function>,
|
|
<function>zip_entry_open</function>, and
|
|
<function>zip_entry_read</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
</reference>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|