PHP closedir() 函数
PHP 教程
· 2019-01-24 12:27:38
实例
打开一个目录,读取它的内容,然后关闭:
<?php
$dir = "/images/";
// Open a directory, and read its contents
if (is_dir($dir)){
if ($dh = opendir($dir)){
while (($file = readdir($dh)) !== false){
echo "filename:" . $file . "<br>";
}
closedir($dh);
}
}
?>
$dir = "/images/";
// Open a directory, and read its contents
if (is_dir($dir)){
if ($dh = opendir($dir)){
while (($file = readdir($dh)) !== false){
echo "filename:" . $file . "<br>";
}
closedir($dh);
}
}
?>
结果:
filename: cat.gif
filename: dog.gif
filename: horse.gif
filename: dog.gif
filename: horse.gif
定义和用法
closedir() 函数关闭目录句柄。
语法
closedir(dir_handle);
| 参数 | 描述 |
|---|---|
| dir_handle | 可选。指定之前由 opendir() 打开的目录句柄资源。如果该参数未指定,则使用最后一个由 opendir() 打开的链接。 |
技术细节
| 返回值: | - |
|---|---|
| PHP 版本: | 4.0+ |
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
Microsoft.NET框架程序设计
Jeffrey Richter / 李建忠 / 清华大学出版社 / 2003-11 / 68.00元
《Microsoft.NET框架程序设计》(修订版)是《微软.NET程序员系列》丛书之一,主要介绍如何开发面向Microsoft.NET框架的各种应用程序。Microsoft.NET框架是微软公司推出的新平台,包含通用语言运行时(CLR)和.NET框架类库(FCL)。《Microsoft.NET框架程序设计》(修订版)将深入解释CLR的工作机制及其提供的各种构造,同时还将讨论FCL中一些重要的类型......一起来看看 《Microsoft.NET框架程序设计》 这本书的介绍吧!