svn: /phpdoc/en/trunk/reference/zip/ziparchive/ getexternalattributesindex.xml

From: Date: Thu, 13 Mar 2014 09:06:55 +0000
Subject: svn: /phpdoc/en/trunk/reference/zip/ziparchive/ getexternalattributesindex.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-12216@lists.php.net to get a copy of this message
remi Thu, 13 Mar 2014 09:06:55 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=332983 Log: One more example Changed paths: U phpdoc/en/trunk/reference/zip/ziparchive/getexternalattributesindex.xml Modified: phpdoc/en/trunk/reference/zip/ziparchive/getexternalattributesindex.xml =================================================================== --- phpdoc/en/trunk/reference/zip/ziparchive/getexternalattributesindex.xml 2014-03-13 09:02:59 UTC (rev 332982) +++ phpdoc/en/trunk/reference/zip/ziparchive/getexternalattributesindex.xml 2014-03-13 09:06:55 UTC (rev 332983) @@ -65,6 +65,38 @@ &return.success; </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + This example extract all the entries of a ZIP + archive <filename>test.zip</filename> and + set the Unix rights from external attributes. + </para> + <example> + <title>Extract all entries with Unix rights</title> + <programlisting role="php"> +<![CDATA[ +<?php +$zip = new ZipArchive(); +if ($zip->open('test.zip') === TRUE) { + for ($idx=0 ; $s = $zip->statIndex($idx) ; $idx++) { + if ($zip->extractTo('.', $s['name'])) { + if ($zip->getExternalAttributesIndex($idx, $opsys, $attr) + && $opsys==ZipArchive::OPSYS_UNIX) { + chmod($s['name'], ($attr & 07777)); + } + } + } + $zip->close(); + echo 'ok'; +} else { + echo 'échec'; +} +?> +]]> + </programlisting> + </example> + </refsect1> </refentry> <!-- Keep this comment at the end of the file

« previous php.doc.cvs (#12216) next »