小编Joh*_*ohn的帖子

php foreach glob多个扩展

必须有一个更好的方法来写这个:

<?php $imagecounter = "no";
    foreach (glob("images/*.jpg") as $image)    {
    $imagecounter = "yes";
    }
    foreach (glob("images/*.png") as $image)    {
    $imagecounter = "yes";
    }
    foreach (glob("images/*.gif") as $image)    {
    $imagecounter = "yes";
    }
    if ($imagecounter == "yes"){Create gallery}?>
Run Code Online (Sandbox Code Playgroud)

该文件夹也可能包含zip或pdf文件,不应创建图库

php foreach glob

2
推荐指数
1
解决办法
2074
查看次数

标签 统计

foreach ×1

glob ×1

php ×1