列出目录中的所有文件
2008-05-27 11:10
204 查看
<?php
// 注意在 4.0.0-RC2 之前不存在 !== 运算符
if ($handle = opendir('C:/AppServ/www'))
{
echo "Directory handle: $handle ";
echo "/n";
echo "Files:/n";
/* 这是正确地遍历目录方法 */
//readdir -- 从目录句柄中读取条目
while (false !== ($file = readdir($handle)))
{
echo "$file/n";
}
/* 这是错误地遍历目录的方法 */
while ($file = readdir($handle))
{
echo "$file/n";
}
closedir($handle);
}
?>
// 注意在 4.0.0-RC2 之前不存在 !== 运算符
if ($handle = opendir('C:/AppServ/www'))
{
echo "Directory handle: $handle ";
echo "/n";
echo "Files:/n";
/* 这是正确地遍历目录方法 */
//readdir -- 从目录句柄中读取条目
while (false !== ($file = readdir($handle)))
{
echo "$file/n";
}
/* 这是错误地遍历目录的方法 */
while ($file = readdir($handle))
{
echo "$file/n";
}
closedir($handle);
}
?>
相关文章推荐
- python列出目录下所有的文件到txt
- [Linux C]列出指定目录下的所有文件(夹)
- Java_IO_列出一个目录的所有文件和目录
- HDFS之globStatus()函数(用通配符匹配制定模式的路径)liststatus() (列出目录下的所有文件)
- 递归列出指定目录下所有的普通文件
- linux下ls 列出所有目录和文件
- 递归列出目录下的所有文件
- C# 列出目录所有文件及子目录所有文件
- awk应用2:列出本目录下所有的隐藏文件和目录
- 当url中未明确指定文件名时,是否列出相关目录下所有文件的开关设置
- 【Unix/Linux】【命令】【文件,目录操作工具】列出所有子目录与文件——ls (ll)命令
- vbs 列出该目录下所有文件和文件夹的类型,大小,和所有者
- PHP-阿里OSS列出bucket下或者‘某个目录下’的所有文件
- java:递归实现输出目录下所有的文件(列出目录下所有的文件)
- ls 列出目标目录中所有的子目录和文件
- 列出某目录下所有文件
- 如何列出某个目录下的所有文件?
- java 列出目录下的文件夹或所有文件
- java程序的递归算法,列出某个目录下的所有子目录和文件
- java------用File类列出一个目录下的所有文件夹和文件