Home > Backend Development > PHP Tutorial > php获取目录下面的图片名称,该如何解决

php获取目录下面的图片名称,该如何解决

WBOY
Release: 2016-06-13 13:38:23
Original
1128 people have browsed it

php获取目录下面的图片名称
如图,我想试着获取该目录下面的所有图片名称,之后,再利用for($i=1,$i
------解决方案--------------------
if ($handle = opendir('/path/..')) {
while (false !== ($file = readdir($handle))) {
echo "$file\n";
}
closedir($handle);
}

------解决方案--------------------
$arr=glob('./*.{jpg,png,gif,jpeg}',GLOB_BRACE);
print_r($arr);
------解决方案--------------------

探讨

$arr=glob('./*.{jpg,png,gif,jpeg}',GLOB_BRACE);
print_r($arr);

------解决方案--------------------
探讨
$arr=glob('./*.{jpg,png,gif,jpeg}',GLOB_BRACE);
print_r($arr);
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template