Iterate over specific files in a directory

前端 未结 1 1500
情话喂你
情话喂你 2021-01-25 02:14

I need to get all images that begin with \"t_\" using glob. What pattern should I use to do this?

        //get any image files that begin with \"t_\" -- (t_imag         


        
相关标签:
1条回答
  • 2021-01-25 03:03
    foreach (glob("t_*.jpg") as $filename) {
        echo "$filename size " . filesize($filename) . "\n";
    }
    

    This implies:

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

    See also:

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

    0 讨论(0)
提交回复
热议问题