我需要使用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;
}
答案 0 :(得分: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";
}
另见: