好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

php递归遍历之遍历文件夹下的所有文件和子文件

php递归遍历之遍历文件夹下的所有文件和子文件

下面我来给大家推荐一个网友写的php递归遍历之遍历文件夹下的所有文件和子文件实例代码,希望对各位朋友有所帮助,写一个函数,能够遍历一个文件夹下的所有文件和子文件夹,代码如下:

$dirs = 'e:/pdf' ;   function  FileShow( $dirs ) {        $dir =opendir( $dirs );        while  ( $f =readdir( $dir )) {        if ( $f  !=  '.'  &&  $f  !=  '..' ){        $file = $dirs . '/' . $f ;        if ( is_file ( $file )){            echo   'FileName:' . $file . '<br />' ;            //echo 'FileName:'.iconv('gb2312','utf-8',$file).'<br />';        } else {           FileShow( $file );           }       }       }   }   FileShow( $dirs ); 

查看更多关于php递归遍历之遍历文件夹下的所有文件和子文件的详细内容...

  阅读:63次