php多级遍历,php jquery实现无限级目录遍历展示代码
前面有講過一個(gè)目錄遍歷的例子,這個(gè)例子有一點(diǎn)不一樣他可以利用php目錄遍歷出來的目錄或文件進(jìn)行一個(gè)樹型的展示效果。
遍歷出來的效果如下
程序代碼
index.php 里面的jquery文件大家可百度下載一個(gè),因?yàn)檫@是用來實(shí)現(xiàn)一個(gè)效果的
| ?代碼如下 | 復(fù)制代碼 | ||||
body {font: normal 12px arial, tahoma, helvetica, sans-serif;margin:0;background:#fff;padding:30px;} *{ margin:0; padding:0;} ul{ visibility:visible; cursor:pointer;} .simpleTree li{font-size:14px; list-style: none;margin:0 0 0 50px;padding:0 0 0 34px;line-height: 18px;margin-left:-13px;background: url(jquery/images/expandable.gif) 0 -2px no-repeat #fff;} .simpleTree li span{display:inline;clear: left;white-space: nowrap;} li.root{padding:0 0 0 20px;line-height:20px;background: url(jquery/images/root.gif) 0 2px no-repeat #fff;} li.file{padding:0 0 0 35px;line-height:20px;background: url(jquery/images/leaf-last.gif) 0 2px no-repeat #fff;} $(function(){ $(".simpleTree").children("li").find("ul").hide(); $("span").click(function(){ var $this_ul=$(this).siblings("ul"); if($this_ul.is(":visible")){ $this_ul.stop(false,true).hide(); }else{ $(this).siblings("ul").stop(false,true).show().end().stop(false,true).siblings("ul").find("ul").hide(); } }) }) include("function.php"); $path="目錄/";//目錄名 echo "
?> function.php 這個(gè)文件包含了遍歷目錄的函數(shù)了
| |||||
總結(jié)
以上是生活随笔為你收集整理的php多级遍历,php jquery实现无限级目录遍历展示代码的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 农林行业的系统应用 php专业,农林|类
- 下一篇: php 格式化html,HTML代码如何