Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 10284

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>instructs phar to intercept fopen, file_get_contents, opendir, and all of the stat-related functions</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="phar.hasmetadata.html">Phar::hasMetadata</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="phar.isbuffering.html">Phar::isBuffering</a></div>
 <div class="up"><a href="class.phar.html">Phar</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="phar.interceptfilefuncs" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Phar::interceptFileFuncs</h1>
  <p class="verinfo">(PHP &gt;= 5.3.0, 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">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="modifier">static</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>Phar::interceptFileFuncs</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   instructs phar to intercept  <span class="function"><a href="function.fopen.html" class="function">fopen()</a></span>,  <span class="function"><a href="function.readfile.html" class="function">readfile()</a></span>,
    <span class="function"><a href="function.file-get-contents.html" class="function">file_get_contents()</a></span>,  <span class="function"><a href="function.opendir.html" 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">Parameters</h3>
  <p class="para">
   No parameters.
  </p>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-phar.interceptfilefuncs-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
  </p>
 </div>


  <div class="refsect1 examples" id="refsect1-phar.interceptfilefuncs-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-683">
    <p><strong>Example #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&nbsp;</span><span style="color: #DD0000">'phar://'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">__FILE__&nbsp;</span><span style="color: #007700">.&nbsp;</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 <em>/path/to/myphar.phar</em> and it
   contains <em>file.php</em> and
   <em>file2.txt</em>, if <em>file.php</em> contains this code:
  </p>
  <p class="para">
   <div class="example" id="example-684">
    <p><strong>Example #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&nbsp;</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 <em>file2.txt</em>,
   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 <em>phar:///path/to/myphar.phar/</em>
   and so opens <em>phar:///path/to/myphar.phar/file2.txt</em> in the above
   example code.
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="phar.hasmetadata.html">Phar::hasMetadata</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="phar.isbuffering.html">Phar::isBuffering</a></div>
 <div class="up"><a href="class.phar.html">Phar</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>