php closedir 函数
closedir
(PHP 4中,PHP 5中)
closedir - 关闭目录句柄
报告错误描述
无效closedir([资源$ dir_handle指定])
关闭目录流dir_handle指定。该流必须是曾开幕opendir()。
报告错误参数
dir_handle指定
处理资源的目录以前与opendir()打开。如果目录句柄没有指定,最后一个环节由opendir()打开假设。
看个实例
$dir = "/etc/php5/";
// Open a known directory, read directory into variable and then close
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
$directory = readdir($dh);
closedir($dh);
}
}
?>
例子
//打开 images 目录
$dir = opendir("images");
//列出 images 目录中的文件
while (($file = readdir($dir)) !== false)
{
echo "filename: " . $file . "
";
}
closedir($dir);
?>
filename: .
filename: ..
filename: cat.gif
filename: dog.gif
filename: food
filename: horse.gif

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Atom editor mac version download
The most popular open source editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
