mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
add docs for addEmptyDir, addFromString, addFile
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@258847 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
64b5d43991
commit
b1f43b0ddf
6 changed files with 677 additions and 0 deletions
101
reference/phar/Phar/addEmptyDir.xml
Normal file
101
reference/phar/Phar/addEmptyDir.xml
Normal file
|
@ -0,0 +1,101 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.addemptydir">
|
||||
<refnamediv>
|
||||
<refname>Phar::addEmptyDir</refname>
|
||||
<refpurpose>Add an empty directory to the phar archive</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>Phar::addEmptyDir</methodname>
|
||||
<methodparam><type>string</type><parameter>dirname</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&phar.write;
|
||||
|
||||
<para>
|
||||
With this method, an empty directory is created with path <literal>dirname</literal>
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>dirname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of the empty directory to create in the phar archive
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
no return value, exception is thrown on failure.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>Phar::addEmptyDir</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
try {
|
||||
$a = new Phar('/path/to/phar.phar');
|
||||
|
||||
$a->addEmptyDir('/full/path/to/file');
|
||||
// demonstrates how this file is stored
|
||||
$b = $a['full/path/to/file']->isDir();
|
||||
} catch (Exception $e) {
|
||||
// handle errors here
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PharData::addEmptyDir</function></member>
|
||||
<member><function>Phar::addFile</function></member>
|
||||
<member><function>Phar::addFromString</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
122
reference/phar/Phar/addFile.xml
Normal file
122
reference/phar/Phar/addFile.xml
Normal file
|
@ -0,0 +1,122 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.addfile">
|
||||
<refnamediv>
|
||||
<refname>Phar::addFile</refname>
|
||||
<refpurpose>Add a file from the filesystem to the phar archive</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>Phar::addFile</methodname>
|
||||
<methodparam><type>string</type><parameter>file</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>localname</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&phar.write;
|
||||
|
||||
<para>
|
||||
With this method, any file or URL can be added to the phar archive. If
|
||||
the optional second parameter <literal>localname</literal> is specified,
|
||||
the file will be stored in the archive with that name, otherwise the
|
||||
<literal>file</literal> parameter is used as the path to store within
|
||||
the archive. URLs must have a localname or an exception is thrown.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>file</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Full or relative path to a file on disk to be added
|
||||
to the phar archive.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>localname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Path that the file will be stored in the archive.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
no return value, exception is thrown on failure.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>Phar::addFile</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
try {
|
||||
$a = new Phar('/path/to/phar.phar');
|
||||
|
||||
$a->addFile('/full/path/to/file');
|
||||
// demonstrates how this file is stored
|
||||
$b = $a['full/path/to/file']->getContent();
|
||||
|
||||
$a->addFile('/full/path/to/file', 'my/file.txt');
|
||||
$c = $a['my/file.txt']->getContent();
|
||||
|
||||
// demonstrate URL usage
|
||||
$a->addFile('http://www.example.com', 'example.html');
|
||||
} catch (Exception $e) {
|
||||
// handle errors here
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>Phar::offsetSet</function></member>
|
||||
<member><function>PharData::addFile</function></member>
|
||||
<member><function>Phar::addFromString</function></member>
|
||||
<member><function>Phar::addEmptyDir</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
117
reference/phar/Phar/addFromString.xml
Normal file
117
reference/phar/Phar/addFromString.xml
Normal file
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.addfromstring">
|
||||
<refnamediv>
|
||||
<refname>Phar::addFromString</refname>
|
||||
<refpurpose>Add a file from the filesystem to the phar archive</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>Phar::addFromString</methodname>
|
||||
<methodparam><type>string</type><parameter>localname</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>contents</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&phar.write;
|
||||
|
||||
<para>
|
||||
With this method, any string can be added to the phar archive.
|
||||
The file will be stored in the archive with <literal>localname</literal> as its
|
||||
path.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>localname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Path that the file will be stored in the archive.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>contents</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The file contents to store
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
no return value, exception is thrown on failure.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>Phar::addFromString</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
try {
|
||||
$a = new Phar('/path/to/phar.phar');
|
||||
|
||||
$a->addFromString('path/to/file.txt', 'my simple file');
|
||||
$b = $a['path/to/file.txt']->getContent();
|
||||
|
||||
// to add contents from a stream handle for large files, use offsetSet()
|
||||
$c = fopen('/path/to/hugefile.bin');
|
||||
$a['largefile.bin'] = $c;
|
||||
fclose($c);
|
||||
} catch (Exception $e) {
|
||||
// handle errors here
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>Phar::offsetSet</function></member>
|
||||
<member><function>PharData::addFromString</function></member>
|
||||
<member><function>Phar::addFile</function></member>
|
||||
<member><function>Phar::addEmptyDir</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
100
reference/phar/PharData/addEmptyDir.xml
Normal file
100
reference/phar/PharData/addEmptyDir.xml
Normal file
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.addemptydir">
|
||||
<refnamediv>
|
||||
<refname>PharData::addEmptyDir</refname>
|
||||
<refpurpose>Add an empty directory to the tar/zip archive</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PharData::addEmptyDir</methodname>
|
||||
<methodparam><type>string</type><parameter>dirname</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
With this method, an empty directory is created with path <literal>dirname</literal>
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>dirname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of the empty directory to create in the phar archive
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
no return value, exception is thrown on failure.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>PharData::addEmptyDir</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
try {
|
||||
$a = new PharData('/path/to/my.tar');
|
||||
|
||||
$a->addEmptyDir('/full/path/to/file');
|
||||
// demonstrates how this file is stored
|
||||
$b = $a['full/path/to/file']->isDir();
|
||||
} catch (Exception $e) {
|
||||
// handle errors here
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>Phar::addEmptyDir</function></member>
|
||||
<member><function>PharData::addFile</function></member>
|
||||
<member><function>PharData::addFromString</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
121
reference/phar/PharData/addFile.xml
Normal file
121
reference/phar/PharData/addFile.xml
Normal file
|
@ -0,0 +1,121 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.addfile">
|
||||
<refnamediv>
|
||||
<refname>PharData::addFile</refname>
|
||||
<refpurpose>Add a file from the filesystem to the tar/zip archive</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>Phar::addFile</methodname>
|
||||
<methodparam><type>string</type><parameter>file</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>localname</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
With this method, any file or URL can be added to the tar/zip archive. If
|
||||
the optional second parameter <literal>localname</literal> is specified,
|
||||
the file will be stored in the archive with that name, otherwise the
|
||||
<literal>file</literal> parameter is used as the path to store within
|
||||
the archive. URLs must have a localname or an exception is thrown.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>file</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Full or relative path to a file on disk to be added
|
||||
to the phar archive.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>localname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Path that the file will be stored in the archive.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
no return value, exception is thrown on failure.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>PharData::addFile</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
try {
|
||||
$a = new PharData('/path/to/my.tar');
|
||||
|
||||
$a->addFile('/full/path/to/file');
|
||||
// demonstrates how this file is stored
|
||||
$b = $a['full/path/to/file']->getContent();
|
||||
|
||||
$a->addFile('/full/path/to/file', 'my/file.txt');
|
||||
$c = $a['my/file.txt']->getContent();
|
||||
|
||||
// demonstrate URL usage
|
||||
$a->addFile('http://www.example.com', 'example.html');
|
||||
} catch (Exception $e) {
|
||||
// handle errors here
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PharData::offsetSet</function></member>
|
||||
<member><function>Phar::addFile</function></member>
|
||||
<member><function>PharData::addFromString</function></member>
|
||||
<member><function>PharData::addEmptyDir</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
116
reference/phar/PharData/addFromString.xml
Normal file
116
reference/phar/PharData/addFromString.xml
Normal file
|
@ -0,0 +1,116 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.addfromstring">
|
||||
<refnamediv>
|
||||
<refname>PharData::addFromString</refname>
|
||||
<refpurpose>Add a file from the filesystem to the tar/zip archive</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PharData::addFromString</methodname>
|
||||
<methodparam><type>string</type><parameter>localname</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>contents</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
With this method, any string can be added to the tar/zip archive.
|
||||
The file will be stored in the archive with <literal>localname</literal> as its
|
||||
path.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>localname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Path that the file will be stored in the archive.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>contents</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The file contents to store
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
no return value, exception is thrown on failure.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>PharData::addFromString</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
try {
|
||||
$a = new PharData('/path/to/my.tar');
|
||||
|
||||
$a->addFromString('path/to/file.txt', 'my simple file');
|
||||
$b = $a['path/to/file.txt']->getContent();
|
||||
|
||||
// to add contents from a stream handle for large files, use offsetSet()
|
||||
$c = fopen('/path/to/hugefile.bin');
|
||||
$a['largefile.bin'] = $c;
|
||||
fclose($c);
|
||||
} catch (Exception $e) {
|
||||
// handle errors here
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PharData::offsetSet</function></member>
|
||||
<member><function>Phar::addFromString</function></member>
|
||||
<member><function>PharData::addFile</function></member>
|
||||
<member><function>PharData::addEmptyDir</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
Loading…
Reference in a new issue