mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-26 13:58:55 +00:00

- All id attributes are now xml:id - Add docbook namespace to all root elements - Replace <ulink /> with <link xlink:href /> - Minor markup fixes here and there git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@238160 c90b9560-bf6c-de11-be94-00142212c4b1
115 lines
3 KiB
XML
115 lines
3 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.3 $ -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.pharfileinfo-construct">
|
|
<refnamediv>
|
|
<refname>PharFileInfo::__construct</refname>
|
|
<refpurpose>Construct a Phar entry object</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>PharFileInfo::__construct</methodname>
|
|
<methodparam><type>string</type><parameter>entry</parameter></methodparam>
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
This should not be called directly. Instead, a PharFileInfo object
|
|
is initialized by calling <function>Phar::offsetGet</function>
|
|
through array access.
|
|
</para>
|
|
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>entry</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The full url to retrieve a file. If you wish to retrieve the information
|
|
for the file <literal>my/file.php</literal> from the phar <literal>boo.phar</literal>,
|
|
the entry should be <literal>phar://boo.phar/my/file.php</literal>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Throws <classname>BadMethodCallException</classname> if
|
|
<function>__construct</function> is called twice.
|
|
Throws <classname>UnexpectedValueException</classname> if
|
|
the phar URL requested is malformed, the requested
|
|
phar cannot be opened, or the file can't be found within the phar.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>A <function>PharFileInfo::__construct</function> example</title>
|
|
<para>
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
try {
|
|
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
|
|
$p['testfile.txt'] = "hi\nthere\ndude";
|
|
$file = $p['testfile.txt'];
|
|
foreach ($file as $line => $text) {
|
|
echo "line number $line: $text";
|
|
}
|
|
// this also works
|
|
$file = new PharFileInfo('phar:///path/to/my.phar/testfile.txt');
|
|
foreach ($file as $line => $text) {
|
|
echo "line number $line: $text";
|
|
}
|
|
} catch (Exception $e) {
|
|
echo 'Phar operations failed: ', $e;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
line number 1: hi
|
|
line number 2: there
|
|
line number 3: dude
|
|
line number 1: hi
|
|
line number 2: there
|
|
line number 3: dude
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</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
|
|
-->
|