Skip to main content

Tedshd's Dev note

php - loop directory

Table of Contents

# php - loop directory

Sometime need use php loop directory list all file in this directory


$directory = scandir('./js');
foreach($directory as $file) {
    if ($file === '.' || $file === '..') {
        continue;
    }
    echo $file;
    echo "\n";
}