Home >Backend Development >PHP Tutorial > php遍历文件夹(取得文件名)

php遍历文件夹(取得文件名)

WBOY
WBOYOriginal
2016-06-13 13:18:451075browse

php遍历文件夹(获得文件名)
http://www.cublog.cn/u1/43167/showart_374765.html

function listFile($dir)
{ 
 $fileArray = array();
 $cFileNameArray = array();
 if($handle = opendir($dir))
 {
  while(($file = readdir($handle)) !== false)
  {
    if($file !="." && $file !="..")
   {
     if(is_dir($dir."\\".$file))
    {
      $cFileNameArray = listFile($dir."\\".$file);
      for($i=0;$i<count else return echo listfile chm var_dump>
 <div class="clear">
                 
              
              
        
            </div></count>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn