<div class="codetitle"> <span><a style="CURSOR: pointer" data="91765" class="copybut" id="copybut91765" onclick="doCopy('code91765')"><u>复制代码</u></a></span>代码如下:</div> <div class="codebody" id="code91765"> <br><div id="jQ-menu"> <BR><?php <BR>$path = "./"; <BR>function createDir($path = '.') <BR>{ <BR>if ($handle = opendir($path)) <BR>{ <BR>echo "<ul>"; <br>while (false !== ($file = readdir($handle))) <br>{ <br>if (is_dir($path.$file) && $file != '.' && $file != '..') <br>printSubDir($file, $path, $queue); <br>else if ($file != '.' && $file !='..') <br>$queue[] = $file; <br>} <br>printQueue($queue, $path); <br>エコー "</ul>"; <br>} <br>} <br>function printQueue($queue, $path) <br>{ <br>foreach ($queue as $file) <br>{ <br>printFile($file, $path) ; <br>} <br>} <br>function printFile($file, $path) <br>{ <br>echo "<li><a href="".$path.$file.""> ;$file</a></li>"; <br>} <br>function printSubDir($dir, $path) <br>{ <br>echo "<li><span class="toggle">$dir</span>"; <br>createDir($path.$dir."/"); <br>エコー "</li>"; <br>} <br>createDir($path); <br>?> <br> </div> <br>