PHP:获取我的图像目录中包含的所有文件名的列表 [英] PHP: Get list of all filenames contained within my images directory

查看:70
本文介绍了PHP:获取我的图像目录中包含的所有文件名的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试找出列出目录中包含的所有文件的方法.我对php的了解还不够好,只能靠我自己解决它,因此希望这里有人可以帮助我.

I have been trying to figure out a way to list all files contained within a directory. I'm not quite good enough with php to solve it on my own so hopefully someone here can help me out.

我需要一个简单的PHP脚本,它将脚本目录中包含的所有文件名加载到数组中.任何帮助将不胜感激,谢谢!

I need a simple php script that will load all filenames contained within my images directory into an array. Any help would be greatly appreciated, thanks!

推荐答案

尝试 glob

类似的东西:

 foreach(glob('./images/*.*') as $filename){
     echo $filename;
 }

这篇关于PHP:获取我的图像目录中包含的所有文件名的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆