File: zip.xml

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (392 lines) | stat: -rw-r--r-- 13,905 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.6 $ -->
 <reference id="ref.zip">
  <title>Zipファイル関数(読込のみ)</title>
  <titleabbrev>Zip</titleabbrev>
  <partintro>
   <para>
    このモジュールは、Guido Draheimにより作成されたZIP圧縮されたアーカイブ
    およびその中のファイルを透過的に読みこむためのライブラリ
    <ulink url="&url.zziplib;">ZZIPlib</ulink>の関数を使用します。
   </para>
   <para>
    ZZIPlib は、ZIPの圧縮アルゴリズムの完全な実装で提供される関数のサブセッ
    トであり、ZIPファイルアーカイブの読込みのみができることに注意して下さい。
    このライブラリで読み込まれるZIPファイルアーカイブを作成するには、通常の
    ZIPユーティリティが必要です。
   </para>
   <para>
    PHPにおけるZipサポートは、デフォルトでは使用できません。
    Zipサポートを有効にしるには、PHPのコンパイル時にconfigureのオプションに
    <link linkend="install.configure.with-zip">--with-zip</link>を指定して
    コンパイルする必要があります。このモジュールは、ZZIPlib バージョン
    &gt;= 0.10.6を必要とします。
   </para>
   <note>
    <para>
     Zipサポートは、PHP 4.1.0以前は実験的なものでした。この拡張モジュー
     ルは、PHP 4.1.0以降に存在するZIP拡張モジュールを反映しています。
    </para>
   </note>
   
   <sect1 id="zip-example">
    <title>使用例</title>
    <para>
     以下の例は、ZIPファイルアーカイブをオープンし、そのアーカイブの中の各
     ファイルを読み込んで、その内容を出力するものです。この例で使用されて
     いる <filename>test2.php</filename> アーカイブは、ZZIPlibソース配布に
     含まれるテスト用のアーカイブの一つです。
    </para>
    <example>
     <title>Zip の使用例</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>Zipファイルアーカイブを閉じる</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>void</type><methodname>zip_close</methodname>
      <methodparam><type>resource</type><parameter>zip</parameter></methodparam>
    </methodsynopsis>
    <para>
     zipファイルアーカイブを閉じます。パラメータ
     <parameter>zip</parameter>は、<function>zip_open</function>により
     以前オープンされたzipアーカイブとする必要があります。
    </para>
    <para>
     この関数には返り値がありません。
    </para>
    <para>
     <function>zip_open</function>および
     <function>zip_read</function>も参照下さい。
   </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.zip-entry-close">
  <refnamediv>
    <refname>zip_entry_close</refname>
    <refpurpose>ディレクトリエントリをクローズする</refpurpose>
   </refnamediv>
   <refsect1>
   <title>説明</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>ディレクトリエントリの圧縮時のサイズを取得する</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</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>ディレクトリエントリの圧縮方法を取得する</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</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>ディレクトリエントリの実際のファイルサイズを取得する</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</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>ディレクトリエントリの名前を取得する</refpurpose>                         
   </refnamediv>
   <refsect1>
    <title>説明</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>読込み用にディレクトリエントリをオープンする</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</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>
     Returns <literal>true</literal> on succes or <literal>false</literal> on failure.
    </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>オープンされたディレクトリエントリから読み込む</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</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 <literal>false</literal> 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>Zipファイルアーカイブをオープンする</refpurpose>
  </refnamediv>
   <refsect1>
    <title>説明</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
     <literal>false</literal> 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>Zipファイルアーカイブの中の次のエントリを読み込む</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</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:
-->