aaa 文件夹中有 1.txt ,2.txt ....10.txt.
<?php
$dir="aaa"; //这里输入其它路径
//$handle=opendir($dir.".");
$handle=opendir($dir."/");
$filerow = array();
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..") {
$filerow[] = $file; //输出文件名
}
}
closedir($handle);
print_r($filerow);
?>
结果:Array ( [0] => 1.txt [1] => 2.txt [2] => 3.txt [3] => 4.txt [4] => 5.txt [5] => 6.txt [6] => 7.txt [7] => 8.txt [8] => 9.txt [9] => 10.txt )

标签:
上一篇:PHP时间运算 下一篇:php 遍历文件夹中夹 返回文件名