📌  相关文章
📜  计算文件夹中的文件 php 代码示例

📅  最后修改于: 2022-03-11 14:54:38.642000             🧑  作者: Mango

代码示例1
// You can get the filecount like so:
$directory = "/path/to/dir/";
$filecount = 0;
$files = glob($directory . "*");
if ($files){
 $filecount = count($files);
}
echo "There were $filecount files";
// where the "*" is you can change that to a specific filetype if you want like "*.jpg" or you could do multiple filetypes like this:
// the GLOB_BRACE flag expands {a,b,c} to match 'a', 'b', or 'c'
// glob($directory . "*.{jpg,png,gif}",GLOB_BRACE);