View Single Post
  #2   IP: 153.99.39.110
Old 2016-08-16, 12:54 AM
Kellerton Kellerton is offline
初级会员
 
Join Date: 2011-06-26
Posts: 1
Kellerton 现在声名狼藉
Default

You can use glob
Code:
$images = glob('/tmp/*.{jpeg,gif,png}', GLOB_BRACE);
If you need this to be case-insensitive, you could use a DirectoryIterator in combination with a RegexIterator or pass the result of scandir to array_map and use a callback that filters any unwanted extensions. Whether you use strpos, fnmatch or pathinfo to get the extension is up to you.
Reply With Quote