下面使用php scandir函数遍历文件夹目录和所有文件,代码如下:
<?php $dir = "."; //当前目录 list_file($dir); function list_file($dir){ $list = scandir($dir); // 得到该文件下的所有文件和文件夹 foreach($list as $file){//遍历 $file_location=$dir."//m.sbmmt.com/m/".$file;//生成路径 if(is_dir($file_location) && $file!="." &&$file!=".."){ //判断是不是文件夹 echo "------------------------sign in $file_location------------------"; list_file($file_location); //继续遍历 } echo "<br/>"; } } ?>
以上就是php scandir()函数遍历文件夹目录和所有文件实例代码的详细内容,更多请关注php中文网其它相关文章!
已抢65593个
抢已抢30362个
抢已抢16720个
抢已抢8456个
抢已抢10982个
抢已抢22591个
抢