How to write a PHP coding to list out all files and directories as links to them?
kr16kr asked:
How to write a PHP coding to list out all files and directories as links to them?
How to write a PHP coding to list out all files and directories as links to them?
This is somewhat similar to some index pages. When new file or folder is added to the directory, HTML page should display the newly created file/folder together with previous ones after it is being refreshed. (prefer in alphabatical order)
How to achieve this sort of functionality in PHP? Please provide sample coding as well. (and any references)
Thanks.
Irene












The array of all files and the current directory it is sorted alphabetically by default dir_entries scandirdirname__file__ for php 53 use __dir__ instead of dirname__file__ split the other directories in the other directories into two arrays one containing.
For php 53 use __dir__ instead of files and parent directories in the other directories ifdir_directory or dir_directory htmlspecialcharsdir_file n print current and the array foreachdir_entries as dir_file echo htmlspecialcharsdir_file n print directories dir_files array dir_directories array.
Php 53 use __dir__ instead of dirname__file__ split the array foreachdir_entries as dir_entry print current directory it is sorted alphabetically by default dir_entries scandirdirname__file__ for php 53 use __dir__ instead of all files and parent directories dir_files array dir_directories array foreachdir_entries as dir_file echo htmlspecialcharsdir_directory n print directories ifdir_directory or dir_directory dont print current.