mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-24 17:02:18 +01:00
115 lines
3.3 KiB
XML
115 lines
3.3 KiB
XML
<?xml version='1.0' encoding='utf-8'?>
|
|
<!-- EN-Revision: f03806fcd8fe03a0501bd40b6e3939ff6589a1d2 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="pharfileinfo.construct" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>PharFileInfo::__construct</refname>
|
|
<refpurpose>Construit un objet d'entrée Phar</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<constructorsynopsis role="PharFileInfo">
|
|
<modifier>public</modifier> <methodname>PharFileInfo::__construct</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</constructorsynopsis>
|
|
<para>
|
|
Cette méthode ne doit pas être appelé directement. A la place, un objet
|
|
<classname>PharFileInfo</classname> est initialisé en appelant
|
|
<function>Phar::offsetGet</function> via un accès de type tableau.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>filename</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
L'URL complète pour récupérer un fichier. Si vous voulez récupérer
|
|
les informations du fichier <literal>mon/fichier.php</literal>
|
|
du phar <literal>boo.phar</literal>, vous devrez préciser
|
|
<literal>phar://boo.phar/mon/fichier.php</literal>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Soulève une exception <classname>BadMethodCallException</classname> si
|
|
<link linkend="object.construct">__construct()</link> est appelé deux fois.
|
|
Soulève une exception <classname>UnexpectedValueException</classname> si
|
|
l'URL du phar demandé est mal formée, si le phar ne peut pas être ouvert ou
|
|
si le fichier ne peut pas être trouvé au sein du phar.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>PharFileInfo::__construct</function></title>
|
|
<para>
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
try {
|
|
$p = new Phar('/chemin/vers/mon.phar', 0, 'mon.phar');
|
|
$p['fichierdetest.txt'] = "salut\nmon\npote";
|
|
$file = $p['fichierdetest.txt'];
|
|
foreach ($file as $line => $text) {
|
|
echo "ligne numéro $line: $text";
|
|
}
|
|
// ceci marche aussi
|
|
$file = new PharFileInfo('phar:///chemin/vers/mon.phar/fichierdetest.txt');
|
|
foreach ($file as $line => $text) {
|
|
echo "ligne numéro $line: $text";
|
|
}
|
|
} catch (Exception $e) {
|
|
echo 'L'opération Phar a échoué : ', $e;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
ligne numéro 1: salut
|
|
ligne numéro 2: mon
|
|
ligne numéro 3: pote
|
|
ligne numéro 1: salut
|
|
ligne numéro 2: mon
|
|
ligne numéro 3: pote
|
|
]]>
|
|
</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:"~/.phpdoc/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
|
|
-->
|