PHP opendir() 函数
实例
<?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); } } ?>
结果
filename: cat.gif filename: dog.gif filename: horse.gif
定义和用法
opendir() 函数打开目录句柄。
语法
opendir(path,context);参数 描述path 必需。规定要打开的目录路径。context 可选。规定目录句柄的环境。context 是可修改目录流的行为的一套选项。
技术细节
以上就是PHP中opendir的用法的详细内容,更多请关注Gxl网其它相关文章!
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did62228