Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: How to write a PHP coding to list out all files and directories as links to them?
Forum PHP.pl > Forum > PHP
Nalcolmjean
How to write a PHP coding to list out all files and directories as links to them?
Sephirus
  1. $directoryPath = '/path/to/directory/with/files/';
  2. $wwwPath = 'http://www.sitename.com/files/';
  3.  
  4. foreach(glob($directoryPath . '*') AS $file) {
  5. echo '<a href="'.$wwwPath.basename($file).'">'.basename($file).'</a><br/>';
  6. }


If i understood U properly wink.gif
viking
You may also be interested in SPL extension http://php.net/manual/en/book.spl.php Please refer to the examples inside documentation of DirectoryIterator, FilesystemIterator etc.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.