当前位置: 移动技术网 > IT编程>开发语言>PHP > php显示当前文件所在的文件以及文件夹所有文件,树形展开

php显示当前文件所在的文件以及文件夹所有文件,树形展开

2018年04月25日  | 移动技术网IT编程  | 我要评论

蚂蚁工坊官网,卫星成人节目,天狼星小包子

  1. $path = "./";
  2. function createDir($path = '.')
  3. {
  4. if ($handle = opendir($path))
  5. {
  6. 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 "
    ";
  7. }
  8. }
  9. function printQueue($queue, $path)
  10. {
  11. foreach ($queue as $file)
  12. {
  13. printFile($file, $path);
  14. }
  15. }
  16. function printFile($file, $path)
  17. {
  18. echo "
  19. $file
  20. ";
  21. }
  22. function printSubDir($dir, $path)
  23. {
  24. echo "
  25. $dir";
  26. createDir($path.$dir."/");
  27. echo "
  28. ";
  29. }
  30. createDir($path);
  31. ?>

  32. 原文地址:https://www.freejs.net/article_jquerywenzi_112.html

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网