resource opendir ( string $path [, resource $context] );
它打开了一个目录句柄,以便在后续的clostrr()、readdir()和rewind dir()调用中使用。
Sr.No | Parameter & Description |
---|---|
1 |
path(必需) 要打开的目录路径 |
2 |
context(可选) 链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-opendir.html 来源:LearnFk无涯教程网 指定目录句柄的context。context是一组options,可以修改流的行为。 |
如果成功,则返回目录句柄资源;如果失败,则返回False。
以下是此函数−的用法
<?php $dir=opendir("/var/www/images"); while (($file=readdir($dir)) !== false) { echo "filename: " . $file . "<br />"; } closedir($dir); ?>
这将产生以下输出−
filename: . filename: .. filename: logo.gif filename: mohd.gif
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)