svn: /phpdoc/en/trunk/reference/zip/ziparchive/ addfile.xml setexternalattributesname.xml

From: Date: Thu, 13 Mar 2014 09:02:59 +0000
Subject: svn: /phpdoc/en/trunk/reference/zip/ziparchive/ addfile.xml setexternalattributesname.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-12215@lists.php.net to get a copy of this message
remi Thu, 13 Mar 2014 09:02:59 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=332982 Log: Add some examples for new methods Changed paths: U phpdoc/en/trunk/reference/zip/ziparchive/addfile.xml U phpdoc/en/trunk/reference/zip/ziparchive/setexternalattributesname.xml Modified: phpdoc/en/trunk/reference/zip/ziparchive/addfile.xml =================================================================== --- phpdoc/en/trunk/reference/zip/ziparchive/addfile.xml 2014-03-13 08:03:16 UTC (rev 332981) +++ phpdoc/en/trunk/reference/zip/ziparchive/addfile.xml 2014-03-13 09:02:59 UTC (rev 332982) @@ -72,7 +72,7 @@ as <filename>newname.txt</filename>. </para> <example> - <title>Open and extract</title> + <title>Open and add</title> <programlisting role="php"> <![CDATA[ <?php Modified: phpdoc/en/trunk/reference/zip/ziparchive/setexternalattributesname.xml =================================================================== --- phpdoc/en/trunk/reference/zip/ziparchive/setexternalattributesname.xml 2014-03-13 08:03:16 UTC (rev 332981) +++ phpdoc/en/trunk/reference/zip/ziparchive/setexternalattributesname.xml 2014-03-13 09:02:59 UTC (rev 332982) @@ -64,6 +64,34 @@ &return.success; </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + This example opens a ZIP file archive + <filename>test.zip</filename> and add + the file <filename>test.txt</filename> + with its Unix rights as external attributes. + </para> + <example> + <title>Archive a file, with its Unix rights</title> + <programlisting role="php"> +<![CDATA[ +<?php +$zip = new ZipArchive(); +$stat = stat($filename='test.txt'); +if (is_array($stat) && $zip->open('test.zip', ZipArchive::CREATE) === TRUE) { + $zip->addFile($filename); + $zip->setExternalAttributesName($filename, ZipArchive::OPSYS_UNIX, $stat['mode']); + $zip->close(); + echo "Ok\n"; +} else { + echo "KO\n"; +} +?> +]]> + </programlisting> + </example> + </refsect1> </refentry> <!-- Keep this comment at the end of the file

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