<?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 => 'de',
  ),
  'this' => 
  array (
    0 => 'phar.interceptfilefuncs.php',
    1 => 'Phar::interceptFileFuncs',
    2 => 'Instructs phar to intercept fopen, file_get_contents, opendir, and all of the stat-related functions',
  ),
  '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' => 'en',
    '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">Instructs phar to intercept fopen, file_get_contents, opendir, and all of the stat-related functions</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-phar.interceptfilefuncs-description">
  <h3 class="title">Beschreibung</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">
   instructs phar to intercept <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>, and all of
   the stat-related functions.  If any of these functions is called from within
   a phar archive with a relative path, the call is modified to access a file
   within the phar archive.  Absolute paths are assumed to be attempts to load
   external files from the filesystem.
  </p>
  <p class="para">
   This function makes it possible to run PHP applications designed to run off of
   a hard disk as a phar application.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-phar.interceptfilefuncs-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   No parameters.
  </p>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-phar.interceptfilefuncs-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
  </p>
 </div>


  <div class="refsect1 examples" id="refsect1-phar.interceptfilefuncs-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 A <span class="function"><strong>Phar::interceptFileFuncs()</strong></span> example</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">'/file.php'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
  <p class="para">
   Assuming that this phar is at <code class="literal">/path/to/myphar.phar</code> and it
   contains <code class="literal">file.php</code> and
   <code class="literal">file2.txt</code>, if <code class="literal">file.php</code> contains this code:
  </p>
  <p class="para">
   <div class="example" id="example-2">
    <p><strong>Beispiel #2 A <span class="function"><strong>Phar::interceptFileFuncs()</strong></span> example</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">'file2.txt'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
  <p class="para">
   Normally PHP would search the current directory for <code class="literal">file2.txt</code>,
   which would translate as the directory of file.php, or the current directory of
   a command-line user.  <span class="function"><strong>Phar::interceptFileFuncs()</strong></span> instructs
   PHP to consider the current directory to be <code class="literal">phar:///path/to/myphar.phar/</code>
   and so opens <code class="literal">phar:///path/to/myphar.phar/file2.txt</code> in the above
   example code.
  </p>
 </div>


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