php显示当前文件所在的文件以及文件夹所有文件以树形展开
代码如下:
<div id="jQ-menu"> <?php $path = "./"; function createDir($path = '.') { if ($handle = opendir($path)) { echo "<ul>"; 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 "</ul>"; } } function printQueue($queue, $path) { foreach ($queue as $file) { printFile($file, $path); } } function printFile($file, $path) { echo "<li><a href=\"".$path.$file."\">$file</a></li>"; } function printSubDir($dir, $path) { echo "<li><span class=\"toggle\">$dir</span>"; createDir($path.$dir."/"); echo "</li>"; } createDir($path); ?> </div>
相关推荐
MXstudying 2020-09-05
WasteLand 2020-09-15
<?php. if (!empty($_POST)) {. $data1 = $_POST["data1"];$data2 = $_POST["data2"];$fuhao = $_POST["fuh
mathchao 2020-09-15
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
Noneyes 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28