php显示当前文件所在的文件以及文件夹所有文件,树形展开
程序员文章站
2023-09-19 23:29:18
$path = "./"; function createDir($path = '.') { if ($han...
- $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);
- ?>
-
原文地址:https://www.freejs.net/article_jquerywenzi_112.html
下一篇: CSS position(定位)属性