Recursive File Search (PHP)

前端 未结 8 957
逝去的感伤
逝去的感伤 2020-11-29 07:57

I\'m trying to return the files in a specified directory using a recursive search. I successfully achieved this, however I want to add a few lines of code that will allow me

8条回答
  •  难免孤独
    2020-11-29 09:01

    Try this, it uses an array of allowed file types and only echos out the file if the file extension exists within the array.

     \n";
        }
    }
    ?>
    

    You may also find that you could pass an array of allowed file types to your RecursiveDirectoryIterator class and only return files that match.

提交回复
热议问题