問題:
This question already has an answer here: 這個問題已經在這裏有了答案:
- Getting the names of all files in a directory with PHP 15 answers 用PHP 15 獲取目錄中所有文件的名稱 答案
- PHP list all files in directory [duplicate] 5 answers PHP列出目錄中的所有文件[重複] 5個答案
What would be the best way to list all the files in one directory with PHP? 用PHP在一個目錄中列出所有文件的最佳方法是什麼? Is there a $_SERVER function to do this? 是否有$ _SERVER函數可以執行此操作? I would like to list all the files in the usernames/ directory and loop over that result with a link, so that I can just click the hyperlink of the filename to get there. 我想列出usernames /目錄中的所有文件,並通過鏈接遍歷該結果,以便我可以單擊文件名的超鏈接到達那裏。 Thanks! 謝謝!
解決方案:
參考一: https://stackoom.com/question/14Bi9參考二: List all files in one directory PHP [duplicate]