PHP file_exists and wildcard

后端 未结 4 1267
孤街浪徒
孤街浪徒 2020-12-03 00:20

Is there a way to write the PHP file_exists function so that it searches a directory for a file with an arbitrary extension. For instance, suppose I knew that a file were c

4条回答
  •  猫巷女王i
    2020-12-03 01:13

    If you need a little more control and are on pre PHP 5.3 you could use a DirectoryIterator or RecursiveDirectoryIterator. Both have a lot of great function for added control and manipulation.

    PHP docs are at DirectoryIterator and RecursiveDirectoryIterator

提交回复
热议问题