<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_23891"> Array <br> ( <br> [C:/testnice] => Array <br> ( [0] => 新建 文本文档.txt ) <br> <br> [C:/testnice复件 nice] => Array <br> ( ) <br> <br> [C:/testnice复件 nice复件 nice] => Array <br> ( [0] => 新建 文本文档.txt ) <br> <br> [C:/test复件 (2) nice] => Array <br> ( [0] => 新建 文本文档.txt ) <br> ) <img alt=""> <div class="blockcode"> <div id="code_htN"><ol> <li>function read_dir_test(& $fileArr, $dir) {</li> <li> if (!$dir) {</li> <li> return null;</li> <li> }</li> <li> $dirHandle = opendir($dir);</li> <li> while ($entry = readdir($dirHandle)) {</li> <li> if ($entry != '.' && $entry != '..') {</li> <li> if (is_dir($dir . DIRECTORY_SEPARATOR . $entry)) {</li> <li> $fileArr[$dir . DIRECTORY_SEPARATOR . $entry] = array();</li> <li> $fileArr = array_merge($fileArr, read_dir_test($fileArr[$dir . DIRECTORY_SEPARATOR . $entry], $dir . DIRECTORY_SEPARATOR . $entry));</li> <li> } else {</li> <li> $fileArr[$dir][] = $entry;</li> <li> }</li> <li> }</li> <li> }</li> <li> return $fileArr;</li> <li>}</li> <li> <li>$fileArr = array();</li> <li>$dir = "C:/test";</li> <li>read_dir_test($fileArr, $dir);</li> <li>print_r($fileArr);</li> </ol></div> <em onclick="copycode($('code_htN'));">复制代码</em> </div> </td></tr></table> <div id="comment_23891" class="cm"> </div> <div id="post_rate_div_23891"></div> <br><br>