<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.pharfileinfo.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'pharfileinfo.construct.php',
    1 => 'PharFileInfo::__construct',
    2 => 'Construit un objet d\'entr&eacute;e Phar',
  ),
  'up' => 
  array (
    0 => 'class.pharfileinfo.php',
    1 => 'PharFileInfo',
  ),
  'prev' => 
  array (
    0 => 'pharfileinfo.compress.php',
    1 => 'PharFileInfo::compress',
  ),
  'next' => 
  array (
    0 => 'pharfileinfo.decompress.php',
    1 => 'PharFileInfo::decompress',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/phar/PharFileInfo/construct.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="pharfileinfo.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">PharFileInfo::__construct</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL phar &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">PharFileInfo::__construct</span> &mdash; <span class="dc-title">Construit un objet d&#039;entrée Phar</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-pharfileinfo.construct-description">
  <h3 class="title">Description</h3>
  <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>PharFileInfo::__construct</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>)</div>

  <p class="para rdfs-comment">
   Cette méthode ne doit pas être appelée directement. À la place, un objet 
   <span class="classname"><a href="class.pharfileinfo.php" class="classname">PharFileInfo</a></span> est initialisé en appelant 
   <span class="function"><a href="phar.offsetget.php" class="function">Phar::offsetGet()</a></span> via un accès de type tableau.
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-pharfileinfo.construct-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">filename</code></dt>
     <dd>
      <p class="para">
       L&#039;URL complète pour récupérer un fichier. Pour récupérer 
       les informations du fichier <code class="literal">mon/fichier.php</code> 
       du phar <code class="literal">boo.phar</code>, il faudra préciser 
       <code class="literal">phar://boo.phar/mon/fichier.php</code>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 
 <div class="refsect1 errors" id="refsect1-pharfileinfo.construct-errors">
  <h3 class="title">Erreurs / Exceptions</h3>
  <p class="para">
   Soulève une exception <span class="classname"><a href="class.badmethodcallexception.php" class="classname">BadMethodCallException</a></span> si
   <a href="language.oop5.decon.php#object.construct" class="link">__construct()</a> est appelé deux fois.
   Soulève une exception <span class="classname"><a href="class.unexpectedvalueexception.php" class="classname">UnexpectedValueException</a></span> si
   l&#039;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.
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-pharfileinfo.construct-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple avec <span class="function"><strong>PharFileInfo::__construct()</strong></span></strong></p>
    <div class="example-contents"><p>
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">try {<br />    </span><span style="color: #0000BB">$p </span><span style="color: #007700">= new </span><span style="color: #0000BB">Phar</span><span style="color: #007700">(</span><span style="color: #DD0000">'/chemin/vers/mon.phar'</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #DD0000">'mon.phar'</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">$p</span><span style="color: #007700">[</span><span style="color: #DD0000">'fichierdetest.txt'</span><span style="color: #007700">] = </span><span style="color: #DD0000">"salut\nmon\npote"</span><span style="color: #007700">;<br />    </span><span style="color: #0000BB">$file </span><span style="color: #007700">= </span><span style="color: #0000BB">$p</span><span style="color: #007700">[</span><span style="color: #DD0000">'fichierdetest.txt'</span><span style="color: #007700">];<br />    foreach (</span><span style="color: #0000BB">$file </span><span style="color: #007700">as </span><span style="color: #0000BB">$line </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$text</span><span style="color: #007700">) {<br />        echo </span><span style="color: #DD0000">"ligne numéro </span><span style="color: #0000BB">$line</span><span style="color: #DD0000">: </span><span style="color: #0000BB">$text</span><span style="color: #DD0000">"</span><span style="color: #007700">;<br />    }<br />    </span><span style="color: #FF8000">// ceci marche aussi<br />    </span><span style="color: #0000BB">$file </span><span style="color: #007700">= new </span><span style="color: #0000BB">PharFileInfo</span><span style="color: #007700">(</span><span style="color: #DD0000">'phar:///chemin/vers/mon.phar/fichierdetest.txt'</span><span style="color: #007700">);<br />    foreach (</span><span style="color: #0000BB">$file </span><span style="color: #007700">as </span><span style="color: #0000BB">$line </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$text</span><span style="color: #007700">) {<br />        echo </span><span style="color: #DD0000">"ligne numéro </span><span style="color: #0000BB">$line</span><span style="color: #DD0000">: </span><span style="color: #0000BB">$text</span><span style="color: #DD0000">"</span><span style="color: #007700">;<br />    }<br />} catch (</span><span style="color: #0000BB">Exception $e</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">'L'</span><span style="color: #0000BB">opération Phar a échoué </span><span style="color: #007700">: </span><span style="color: #DD0000">', $e;<br />}<br />?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>L&#039;exemple ci-dessus va afficher :</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">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</pre>
</div>
    </div>
   </div>
  </p>
 </div>

</div><?php manual_footer($setup); ?>