小白教程
所有教程
关于
Search
172.69.6.207
172.69.6.207
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Func directory closedir”的源代码
本页内容
上一节:
Func_directory_chroot
下一节:
Func_directory_dir
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:closedir()}}[[Category:PHP Directory 文件目录参考手册|3]] = PHP closedir() 函数 = [[:Category:PHP Directory 文件目录参考手册]] 打开一个目录,读取它的内容,然后关闭: <sample title="" desc="" lang="php" hererun="1"> <?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); } } ?> </sample> 结果: <sample title="" desc="" lang="php" hererun="1"> filename: cat.gif filename: dog.gif filename: horse.gif </sample> == 定义和用法 == closedir() 函数关闭目录句柄。 == 语法 == <pre> closedir(dir_handle);</pre> {| class="table table-striped table-hover" ! 参数 ! 描述 |- | dir_handle | 可选。指定之前由 [[func directory opendir|opendir()]] 打开的目录句柄资源。如果该参数未指定,则使用最后一个由 opendir() 打开的链接。 |} == 技术细节 == {| class="table table-striped table-hover" | 返回值: | - |- | PHP 版本: | 4.0+ |} [[:Category:PHP Directory 文件目录参考手册]]
返回至“
Func directory closedir
”。
上一节:
Func_directory_chroot
下一节:
Func_directory_dir