LoginSignup
7
4

More than 5 years have passed since last update.

ディレクトリの中のファイルだけを取得する

Posted at
$file_arr = scandir($filepath);
$file = array();
foreach ($file_arr as $file) {
    // . ..の場合はスキップ
    if (in_array($file, array('.', '..')))
        continue;
    // ディレクトリの場合もスキップ
    if (is_dir(($filepath . $file)))
        continue;
    // ここまで来たら対象ファイル
    $file[] = $file;
}

説明はありません。

7
4
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
4