您的位置:首页 > 编程语言 > PHP开发

PHP遍历目录下的所有文件

2015-08-11 16:09 639 查看
<pre name="code" class="php"><?php
function scan_dir($dir){
$i = 0;
if ($handle =opendir($dir)){
while (false !==($file = readdir($handle))){
if ($file !='.'&& $file !='..'){
$fullpath = $dir.'/'.$file;
if (is_dir($fullpath)){
scandir($fullpath);
echo $fullpath;
$i++;
}else{
echo $fullpath;
$i++;
}
}
}
}
closedir($handle);
}



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php