list all files in directory php
snippet in php

list all files in directory php

user5698

$path    = './';
$files = scandir($path);
$files = array_diff(scandir($path), array('.', '..'));
foreach($files as $file){
  echo "<a href='$file'>$file</a>";
}

php list all files in directory

user6442

scandir ( string $directory [, int $sorting_order = SCANDIR_SORT_ASCENDING [, resource $context ]] ) : array