<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.dir.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.readdir.php',
    1 => 'readdir',
    2 => '从目录句柄中读取条目',
  ),
  'up' => 
  array (
    0 => 'ref.dir.php',
    1 => '目录函数函数',
  ),
  'prev' => 
  array (
    0 => 'function.opendir.php',
    1 => 'opendir',
  ),
  'next' => 
  array (
    0 => 'function.rewinddir.php',
    1 => 'rewinddir',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/dir/functions/readdir.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.readdir" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">readdir</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">readdir</span> &mdash; <span class="dc-title">从目录句柄中读取条目</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.readdir-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>readdir</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span></span> <code class="parameter">$dir_handle</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="simpara">
   返回目录中下一个文件的文件名。文件名以在文件系统中的排序返回。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.readdir-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">dir_handle</code></dt>
    <dd>
     <span class="simpara">
      先前通过 <span class="function"><a href="function.opendir.php" class="function">opendir()</a></span> 打开的目录句柄 <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>。如果
      <code class="parameter">dir_handle</code> 为 <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>，则使用最近一次通过
      <span class="function"><a href="function.opendir.php" class="function">opendir()</a></span> 打开的句柄。
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.readdir-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="simpara">
   成功则返回文件名 或者在失败时返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>
  </p>
  <div class="warning"><strong class="warning">警告</strong><p class="simpara">此函数可能返回布尔值
<strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>，但也可能返回等同于 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> 的非布尔值。请阅读 <a href="language.types.boolean.php" class="link">布尔类型</a>章节以获取更多信息。应使用
<a href="language.operators.comparison.php" class="link">===
运算符</a>来测试此函数的返回值。</p></div>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.readdir-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.5.0</td>
      <td>
       现在已弃用将 <code class="parameter">dir_handle</code> 设为 <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> 的做法，应明确提供最近打开的目录句柄。
      </td>
     </tr>

     <tr>
      <td>8.0.0</td>
      <td>
       现在 <code class="parameter">dir_handle</code> 可以为 null。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.readdir-examples">
  <h3 class="title">示例</h3>
  <p class="simpara">
   完整示例请参见 <span class="function"><a href="function.opendir.php" class="function">opendir()</a></span> 的文档。
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.readdir-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.opendir.php" class="function" rel="rdfs-seeAlso">opendir()</a> - 打开目录句柄</span></li>
   <li><span class="function"><a href="function.rewinddir.php" class="function" rel="rdfs-seeAlso">rewinddir()</a> - 倒回目录句柄</span></li>
   <li><span class="function"><a href="function.closedir.php" class="function" rel="rdfs-seeAlso">closedir()</a> - 关闭目录句柄</span></li>
   <li><span class="function"><a href="function.dir.php" class="function" rel="rdfs-seeAlso">dir()</a> - 返回一个 Directory 类实例</span></li>
   <li><span class="function"><a href="function.is-dir.php" class="function" rel="rdfs-seeAlso">is_dir()</a> - 判断给定文件名是否是一个目录</span></li>
   <li><span class="function"><a href="function.glob.php" class="function" rel="rdfs-seeAlso">glob()</a> - 寻找与模式匹配的文件路径</span></li>
   <li><span class="function"><a href="function.scandir.php" class="function" rel="rdfs-seeAlso">scandir()</a> - 列出指定路径中的文件和目录</span></li>
  </ul>
 </div>

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