1

我需要使用 glob 获取所有以“t_”开头的图像。我应该使用什么模式来做到这一点?

        //get any image files that begin with "t_" -- (t_image.jpg) not (image.jpg)
        $images = glob("" . $dir . "*.jpg");

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

1 回答 1

4
foreach (glob("t_*.jpg") as $filename) {
    echo "$filename size " . filesize($filename) . "\n";
}

这意味着:

foreach (glob("$dir/t_*.jpg") as $filename) {
    echo "$filename size " . filesize($filename) . "\n";
}

也可以看看:

http://ca2.php.net/manual/en/function.glob.php

于 2010-06-26T04:27:06.947 回答