array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.closedir.php', 1 => 'closedir', ), 'up' => array ( 0 => 'ref.dir.php', 1 => '目录函数函数', ), 'prev' => array ( 0 => 'function.chroot.php', 1 => 'chroot', ), 'next' => array ( 0 => 'function.dir.php', 1 => 'dir', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/dir/functions/closedir.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
closedir — 关闭目录句柄
没有返回值。
示例 #1 closedir() 例子
<?php
$dir = "/etc/php5/";
// 打开已知目录,读取目录到变量并然后关闭
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
$directory = readdir($dh);
closedir($dh);
}
}
?>