Advertisement
garfield

[PHP]: Listar diretório com link e excessão.

Nov 5th, 2011
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. /*=================================================================
  2.          _ ____         _____             __
  3.         (_)  _ \ ___  |_   _|__  __ _|  \/  |
  4.         | | |_) / __|   | |/ _ \/ _` | |\/| |
  5.         | |  __/\__ \   | |  __/ (_| | |  | |
  6.         |_|_|   |___/   |_|\___|\__,_|_|  |_|
  7.  
  8.             Criado Por SuYaNw Dácio
  9.             www.ips-team.blogspot.com
  10.    
  11. =================================================================*/
  12.  
  13. function ShowDirectory($dir = ".", $Ex = "")
  14. {
  15.     $dir = opendir('.');
  16.     while (false !== ($file = readdir($dir)))
  17.         if(strstr($file, $Ex))
  18.             echo "<a href='$file'>$file</a><br>";
  19.     closedir($dir);
  20. }
  21.  
  22.  
  23. // Exemplo de uso.
  24.  
  25. ShowDirectory(".", ".txt"); // Exibe somente os arquivos arquivos de textos
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement