📜  php 获取目录中的所有txt文件 - PHP代码示例

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

代码示例1
$path = '/path/to/directory';
$files = glob($path."/*.txt");
foreach ($files as $file) {
  echo $file;
  echo '
'; } /* Outputs something like: /path/to/directory/someFile.txt /path/to/directory/someOtherFile.txt /path/to/directory/anotherFile.txt */