<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_65570"> php自带的rmdir,只能删除空目录,这个rrmdir就可以递归删除目录及目录下的所有文件 <div class="blockcode"> <div id="code_uv0"><ol> <li>function rrmdir($dir) {</li> <li> if (is_dir($dir)) {</li> <li> $objects = scandir($dir);</li> <li> foreach ($objects as $object) {</li> <li> if ($object != “.” && $object != “..”) {</li> <li> if (filetype($dir.”/”.$object) == “dir”) rrmdir($dir.”/”.$object); else unlink($dir.”/”.$object);</li> <li> }</li> <li> }</li> <li> reset($objects);</li> <li> }</li> <li> }</li> </ol></div> <em onclick="copycode($('code_uv0'));">复制代码</em> </div> <br> </td></tr></table> <div class="ptg mbm mtn"> php</div> <div id="comment_65570" class="cm"> </div> <div id="post_rate_div_65570"></div> <br><br>