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

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

WBOY
WBOYOriginal
2016-06-13 13:38:231111browse

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);
Statement:
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