<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>echo "</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="%5C%22%22.%24path.%24file.%22%5C%22">$file</a></li>"; <br>} <br>function printSubDir($dir, $path) <br>{ <br>echo "<li> <span class='\"toggle\"'>$dir</span>"; <br>createDir($path.$dir."/"); <br>echo "</li>"; <br>} <br>createDir($path); <br>?> <br> </div> <br> </div>