PHP文件列出了多个文件扩展名 [英] PHP file listing multiple file extensions
本文介绍了PHP文件列出了多个文件扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我当前的代码:
$files = glob("*.jpg");
这很好.但是,我想列出其他图像类型,例如.png,gif等.
This works fine. However, I am wanting to list other image types, such as .png, gif etc.
请帮助我修改上面的代码以使其正常工作.我尝试了以下方法,但均未成功:
Can I please have some help to modify this above code to get it working. I have tried the following with no success:
$files = glob("*.jpg","*.png","*.gif");
$files = glob("*.jpg,*.png,*.gif);
其他变化...
推荐答案
$files = glob("*.{jpg,png,gif}", GLOB_BRACE);
这篇关于PHP文件列出了多个文件扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文