PHP loops through the function code that lists the contents of a directory

  • 2020-03-31 20:49:20
  • OfStack

 
function list_files($dir) 
{ 
if(is_dir($dir)) 
{ 
if($handle = opendir($dir)) 
{ 
while(($file = readdir($handle)) !== false) 
{ 
if($file != "." && $file != ".." && $file != "Thumbs.db") 
{ 
echo '<a target="_blank" href="'.$dir.$file.'">'.$file.'</a><br>'."n"; 
} 
} 
closedir($handle); 
} 
} 
} 

Here is an excerpt from a previous post on this site. More tips are available.
(link: #)

Related articles: