当前位置:Gxlcms >
PHP教程 >
php显示当前文件所在的文件以及文件夹所有文件,树形展开_PHP教程
php显示当前文件所在的文件以及文件夹所有文件,树形展开_PHP教程
时间:2021-07-01 10:21:17
帮助过:2人阅读
-
-
- $path = "./";
-
- function createDir($path = '.')
- {
- if ($handle = opendir($path))
- {
- echo "
"; -
- while (false !== ($file = readdir($handle)))
- {
- if (is_dir($path.$file) && $file != '.' && $file !='..')
- printSubDir($file, $path, $queue);
- else if ($file != '.' && $file !='..')
- $queue[] = $file;
- }
-
- printQueue($queue, $path);
- echo "
"; - }
- }
-
- function printQueue($queue, $path)
- {
- foreach ($queue as $file)
- {
- printFile($file, $path);
- }
- }
-
- function printFile($file, $path)
- {
- echo "
- $file
"; - }
-
- function printSubDir($dir, $path)
- {
- echo "
- $dir";
- createDir($path.$dir."/");
- echo "
"; - }
-
- createDir($path);
- ?>
-
-
原文地址:http://www.freejs.net/article_jquerywenzi_112.html
http://www.bkjia.com/PHPjc/621624.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/621624.htmlTechArticle$path = "./"; function createDir($path = '.') { if ($handle = opendir($path)) { echo " "; while (false !== ($file = readdir($handle))) { if (is_dir($path.$file) $file != '.' $file...