<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.phar.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'phar.interceptfilefuncs.php',
    1 => 'Phar::interceptFileFuncs',
    2 => 'Informe phar qu\'il doit intercepter les fonctions de fichiers',
  ),
  'up' => 
  array (
    0 => 'class.phar.php',
    1 => 'Phar',
  ),
  'prev' => 
  array (
    0 => 'phar.hasmetadata.php',
    1 => 'Phar::hasMetadata',
  ),
  'next' => 
  array (
    0 => 'phar.isbuffering.php',
    1 => 'Phar::isBuffering',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/phar/Phar/interceptFileFuncs.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="phar.interceptfilefuncs" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Phar::interceptFileFuncs</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL phar &gt;= 2.0.0)</p><p class="refpurpose"><span class="refname">Phar::interceptFileFuncs</span> &mdash; <span class="dc-title">Informe phar qu&#039;il doit intercepter les fonctions de fichiers</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-phar.interceptfilefuncs-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>Phar::interceptFileFuncs</strong></span>(): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <p class="para rdfs-comment">
   Informe phar d&#039;intercepter <span class="function"><a href="function.fopen.php" class="function">fopen()</a></span>, <span class="function"><a href="function.readfile.php" class="function">readfile()</a></span>,
   <span class="function"><a href="function.file-get-contents.php" class="function">file_get_contents()</a></span>, <span class="function"><a href="function.opendir.php" class="function">opendir()</a></span> et toutes les fonctions
   relatives à stat. Si n&#039;importe laquelle de ces fonctions est appelée depuis l&#039;archive phar
   avec un chemin relatif, l&#039;appel est modifié pour accéder à un fichier au sein de l&#039;archive.
   Les chemins absolus sont supposés être des tentatives de chargement de fichiers externes à 
   partir du système de fichiers.
  </p>
  <p class="para">
   Cette fonction rend possible l&#039;exécution d&#039;applications PHP conçues
   pour être lancées en dehors d&#039;un disque dur, en tant qu&#039;application phar.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-phar.interceptfilefuncs-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   Aucun paramètre.
  </p>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-phar.interceptfilefuncs-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
  </p>
 </div>


  <div class="refsect1 examples" id="refsect1-phar.interceptfilefuncs-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>Phar::interceptFileFuncs()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />Phar</span><span style="color: #007700">::</span><span style="color: #0000BB">interceptFileFuncs</span><span style="color: #007700">();<br />include </span><span style="color: #DD0000">'phar://' </span><span style="color: #007700">. </span><span style="color: #0000BB">__FILE__ </span><span style="color: #007700">. </span><span style="color: #DD0000">'/fichier.php'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
  <p class="para">
   En supposant que ce phar est nommé <code class="literal">/chemin/vers/monphar.phar</code> et qu&#039;il
   contient <code class="literal">fichier.php</code> et
   <code class="literal">fichier2.txt</code>, si <code class="literal">fichier.php</code> contient ce code :
  </p>
  <p class="para">
   <div class="example" id="example-2">
    <p><strong>Exemple #2 Un exemple avec <span class="function"><strong>Phar::interceptFileFuncs()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'fichier2.txt'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
  <p class="para">
   Normalement, PHP chercherait dans le répertoire courant le fichier nommé <code class="literal">file2.txt</code>,
   c&#039;est-à-dire dans le répertoire de fichier.php ou le répertoire courant de l&#039;utilisateur de la ligne
   de commande. <span class="function"><strong>Phar::interceptFileFuncs()</strong></span> dit à
   PHP de considérer <code class="literal">phar:///chemin/vers/monphar.phar/</code> comme répertoire courant
   et ainsi ouvre dans l&#039;exemple ci-dessus le fichier <code class="literal">phar:///chemin/vers/monphar.phar/fichier2.txt</code>.
  </p>
 </div>


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