从php中的文件夹中获取所有图像 [英] get all the images from a folder in php

查看:24
本文介绍了从php中的文件夹中获取所有图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 WordPress.我有一个像 mytheme/images/myimages 这样的图像文件夹.

I am using WordPress. I have an image folder like mytheme/images/myimages.

我想从文件夹 myimages

请给我建议,我怎样才能获得图片名称.

Please advice me, how can I get images name.

推荐答案

试试这个

$directory = "mytheme/images/myimages";
$images = glob($directory . "/*.jpg");

foreach($images as $image)
{
  echo $image;
}

这篇关于从php中的文件夹中获取所有图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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