The principle of the function is very simple, mainly using recursive calls.
Copy code The code is as follows:
function file_list($path){
if ($handle = opendir($ path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($path."/".$file)) {
echo $path.": ".$file."
";//Remove this line to display all non-directories File
file_list($path."/".$file);
} else {
echo $path.": ".$file."
";
}
}
}
}
}
This function can also continue to make some improvements, adding some folder or file icons, etc., so that it can be made more powerful This is a function. Friends who are interested can expand it.
http://www.bkjia.com/PHPjc/322337.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322337.htmlTechArticleThe principle of the function is very simple, mainly using recursive calls. Copy the code The code is as follows: function file_list($path){ if ($handle = opendir($path)) { while (false !== ($file = re...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn