<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.filesystem.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.fstat.php',
    1 => 'fstat',
    2 => 'オープンしたファイルポインタからファイルに関する情報を取得する',
  ),
  'up' => 
  array (
    0 => 'ref.filesystem.php',
    1 => 'ファイルシステム 関数',
  ),
  'prev' => 
  array (
    0 => 'function.fseek.php',
    1 => 'fseek',
  ),
  'next' => 
  array (
    0 => 'function.fsync.php',
    1 => 'fsync',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/filesystem/functions/fstat.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.fstat" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">fstat</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">fstat</span> &mdash; <span class="dc-title">オープンしたファイルポインタからファイルに関する情報を取得する</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.fstat-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>fstat</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$stream</code></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   ファイルポインタ<code class="parameter">stream</code>によりオープンされたファイルの統計情報を取得します。
   この関数は関数<span class="function"><a href="function.stat.php" class="function">stat()</a></span>に似ていますが、
   ファイル名の代わりにオープンされたファイルポインタを指定するところが異なります。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.fstat-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">stream</code></dt>
     <dd>
      <p class="para"><span class="function"><a href="function.fopen.php" class="function">fopen()</a></span>
を使用して作成したファイルシステムポインタリソース。</p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.fstat-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   ファイルの統計情報の配列を返します。配列のフォーマットについては
   <span class="function"><a href="function.stat.php" class="function">stat()</a></span>のマニュアルをご覧ください。
   失敗時に <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.fstat-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>例1 <span class="function"><strong>fstat()</strong></span> の例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">// ファイルをオープンする<br /></span><span style="color: #0000BB">$fp </span><span style="color: #007700">= </span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">"/etc/passwd"</span><span style="color: #007700">, </span><span style="color: #DD0000">"r"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// 統計情報を収集する<br /></span><span style="color: #0000BB">$fstat </span><span style="color: #007700">= </span><span style="color: #0000BB">fstat</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// ファイルをクローズする<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// 連想配列部のみ表示する<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">array_slice</span><span style="color: #007700">(</span><span style="color: #0000BB">$fstat</span><span style="color: #007700">, </span><span style="color: #0000BB">13</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>上の例の出力は、
たとえば以下のようになります。</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Array
(
    [dev] =&gt; 771
    [ino] =&gt; 488704
    [mode] =&gt; 33188
    [nlink] =&gt; 1
    [uid] =&gt; 0
    [gid] =&gt; 0
    [rdev] =&gt; 0
    [size] =&gt; 1114
    [atime] =&gt; 1061067181
    [mtime] =&gt; 1056136526
    [ctime] =&gt; 1056136526
    [blksize] =&gt; 4096
    [blocks] =&gt; 8
)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.fstat-notes">
  <h3 class="title">注意</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: <span class="simpara">この関数では、
<a href="features.remote-files.php" class="link">リモートファイル</a> を
使用することはできません。これは、処理されるファイルがサーバーの
ファイルシステムによりアクセスできる必要があるためです。</span></p></blockquote>
 </div>


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