<?php
$dir = "D:/www/mycms/"; //目录名称必须是这种格式
$space="";
function fun1($dir,$space="") {
if(is_dir($dir) && $handle = opendir($dir)){
$space .= " ";
while(false!== ($file = readdir($handle))){
if($file=="." || $file=="..") continue;
if(is_dir($dir.$file.'/')){
echo "$space|-$file<br>";
fun1($dir.$file.'/',$space);
}else
echo "$space|-$file<br>";
}
closedir($handle);
}else{
echo "This have a error!";
}
}
fun1($dir);
结果如下:
|-.buildpath
|-.cache
|-.dataModel
|-.wsdlDataModel
|-.htaccess
|-.project
|-.settings
|-com.zend.php.javabridge.core.prefs
|-org.eclipse.core.resources.prefs
|-org.eclipse.php.core.projectOptions.prefs
|-17Joys
|-Common
|-common.php
|-index.html
|-Conf
|-config.php
|-index.html
|-routes.php
|-index.html
|-Lang
|-Lib
|-Action
|-ArticleAction.class.php
|-CategoryAction.class.php
|-CommonAction.class.php
|-EmptyAction.class.php
|-index.html
|-IndexAction.class.php
|-SectionAction.class.php
|-index.html
|-Model
|-Widget
|-index.html
|-LatestNews
|-latestnews.html
|-LatestNewsWidget.class.php
|-Menu
|-rankmenu.html
|-verticalmenu.html
|-MenuWidget.class.php
|-Runtime
|-Cache
|-2b697f08134c15116f38b3f673ae721b.php
|-429473c0120d0d3fc4e344102dd1ee11.php
|-433e8741d09f4259f2a4461945349644.php
|-516a03b3e253529bd587814bc65f7d14.php
|-82bd435fe269ae1255ddc2237bad6ab6.php
|-ae7ea667007b4b845539d92e25060b04.php
|-d729620f8411f3ba7790f69e3edfb180.php
|-db91b8efcc16e22aa4d3a3e4fb0334b8.php
|-f3aa1d03df37aa5bb4c98ad87d56aea2.php
|-Data
|-_fields
|-Article.php
|-Category.php
|-MenuItem.php
|-Modules.php
|-Section.php
|-User.php
|-index.html
|-Logs
|-Temp
|-~app.php
|-~runtime.php
|-Tpl
|-default
|-Article
|-view.html
|-Category
|-view.html
|-Index
|-index.html
|-index.html
|-Layout
|-index.html
|-left.html
|-tpl.html
|-Modules
|-left.html
|-Public
|-ad
|-01.gif
|-02.gif
|-03.gif
|-04.gif
|-06.gif
|-5.gif
|-6.gif
|-7.gif
|-8.gif
|-avng.html
|-avngg.html
|-index2.html
|-index3.html
|-index4.html
|-listg.html
|-listgg.html
|-listx.html
|-quanding.html
|-topad.html
|-css
|-main.css
|-style.css
|-img
|-12.gif
|-hd_bg.gif
|-ico-1.gif
|-linux_bg.jpg
|-linux_bg1.jpg
|-mav01.jpg
|-mav02.jpg
|-mav_bg.jpg
|-pic_04.jpg
|-titlehead_bg.jpg
|-titlehead_bg2.jpg
|-js
|-huan.js
|-success.html
|-swfimg
|-image1.jpg
|-image2.jpg
|-image3.jpg
|-image4.jpg
|-image5.jpg
|-Section
|-view.html
|-index.html
|-Admin
|-Common
|-common.php
|-index.html
|-Conf
|-config.php
|-index.html
|-index.html
|-Lang
|-Lib
|-Action
|-AccessAction.class.php
|-AlumnusAction.class.php
|-ArticleAction.class.php
|-CategoryAction.class.php
|-CommonAction.class.php
|-ConfigAction.class.php
|-index.html
|-IndexAction.class.php
|-MenuAction.class.php
|-MenuItemAction.class.php
|-ModulesAction.class.php
|-NodeAction.class.php
|-PublicAction.class.php
|-RoleAction.class.php
|-SectionAction.class.php
|-UserAction.class.php
|-index.html
|-Model
|-AccessModel.class.php
|-AlumnusModel.class.php
|-ArticleModel.class.php
|-ArticleViewModel.class.php
|-CategoryModel.class.php
|-CategoryViewModel.class.php
|-index.html
|-MenuItemModel.class.php
|-MenuModel.class.php
|-ModulesModel.class.php
|-NodeModel.class.php
|-RoleModel.class.php
|-SectionModel.class.php
|-UserModel.class.php
|-Widget
|-index.html
|-LatestNews
|-params.html
|-LatestNewsWidget.class.php
|-Menu
|-params.html
|-MenuWidget.class.php
|-Runtime
|-Cache
|-09680558c26c439d3958389625469dfb.php
|-10ed7f61fa5ae1b6b514a001f3954ece.php
|-17ed093d2ea22a9d39fe4a8a875212f8.php
|-26956f6d7a1fa4a64c8e6ebf0aa5ffb2.php
|-2d9b4c6c484485abb77de5747c1664a2.php
|-414e3a5ff156eeda5d5c67b81faabcf3.php
|-41e12b6631cadb4952ffa282e2f9f831.php
|-4b399b4db08b024d9aeca44100f374e1.php
|-4c2a751b0d436380059818371adbe012.php
|-5162534bf68be385b5224970ab92a2fb.php
|-72b651a3b8ccc637b63cd16fbf382d91.php
|-8036b6ce8dcda916f02254a7b19498b1.php
|-9733200c8880ffaf04dd02a7799719f8.php
|-9af84c1a9c059e97e6c75e31c8534daf.php
|-9c7ee6071e987885a8dc1bf82898d94f.php
|-a321e026876aaee7f3a56a25d173aa20.php
|-c06fefb69f9ef62392cf9dc41d840bda.php
|-c43067ef845fef4eec5db14c625b53cb.php
|-c8924135b0404b90d8e729822e809ced.php
|-ca93968f851dd16a3c934c5ad2c53e40.php
|-ccebb963211766d348bae5a89bc22f09.php
|-d8952480d2c91ae78a28d94bd3912705.php
|-da6600f1a26076dcd30bcf6ea8a034be.php
|-e6a9706effcfcf6052417dd957d713f5.php
|-e90a1b399cee0e902de07c7da2d590b5.php
|-ef5aacde02030de23b6a00edc592530c.php
|-Data
|-_fields
|-Alumnus.php
|-Article.php
|-Category.php
|-Menu.php
|-MenuItem.php
|-Modules.php
|-Node.php
|-Role.php
|-RoleUser.php
|-Section.php
|-User.php
|-index.html
|-Logs
|-Temp
|-~app.php
|-~runtime.php
|-Tpl
|-default
|-Access
|-action.html
|-app.html
|-control.html
|-edit.html
|-index.html
|-index_bak.html
|-Alumnus
|-add.html
|-index.html
|-Article
|-add.html
|-edit.html
|-helper.html
|-index.html
|-Category
|-add.html
|-edit.html
|-helper.html
|-index.html
|-Config
|-config.html
|-server.html
|-Index
|-index.html
|-index.html
|-Menu
|-add.html
|-edit.html
|-index.html
|-MenuItem
|-add.html
|-component.html
|-edit.html
|-index.html
|-Modules
|-add.html
|-edit.html
|-index.html
|-modules.html
|-Node
|-index.html
|-Public
|-css
|-17joys.css
|-core.css
|-ieHack.css
|-login.css
|-style.css
|-images
|-!.gif
|-ad.gif
|-add.gif
|-back.gif
|-bg.gif
|-bigsize.jpg
|-bootnbg.jpg
|-bullet.gif
|-buttom-copy-bg.gif
|-buttom-left.gif
|-buttom-right.gif
|-buttom_bgs.gif
|-buttom_left2.gif
|-buttom_right2.gif
|-card.jpg
|-check-out_.gif
|-close.gif
|-content-bg-line.gif
|-content-bg.gif
|-database_import_.gif
|-DefaultDocs.gif
|-defind.gif
|-del.jpg
|-delete.gif
|-delete_6.gif
|-edit.gif
|-ershou_1.gif
|-ershou_2.gif
|-format.gif
|-fox.css
|-g.gif
|-gw.gif
|-gw2.gif
|-icon-demo.gif
|-icon-login-seaver.gif
|-icon-mail2.gif
|-icon-phone.gif
|-icon2_004.png
|-icon2_089.png
|-icon2_090.png
|-imagedelete.gif
|-imageedit.gif
|-image_(add)6.gif
|-image_1.gif
|-ipsecurity.gif
|-l1b3.gif
|-l1b4.gif
|-l1b5.gif
|-left-bg.gif
|-left-top-right.gif
|-line2.jpg
|-linkspic3.gif
|-linkspic6.gif
|-lm.gif
|-lminfo.gif
|-login-buttom-bg.gif
|-login-content-bg.gif
|-login-top-bg.gif
|-login-wel.gif
|-login_bg.jpg
|-Login_but.gif
|-logo.png
|-logo2.gif
|-logo2.png
|-luck.gif
|-mail_leftbg.gif
|-mail_rightbg.gif
|-menu_bg.gif
|-menu_bg1.gif
|-menu_bg2.gif
|-menu_bgs.gif
|-menu_topimg.gif
|-menu_topline.gif
|-mime.gif
|-nav-right-bg.gif
|-news-title-bg.gif
|-ok.gif
|-OK.jpg
|-out.gif
|-panel
|-panel.png
|-panel_icon.png
|-password.gif
|-pic1.gif
|-pic10.gif
|-pic11.gif
|-pic12.gif
|-pic13.gif
|-pic14.gif
|-pic15.gif
|-pic16.gif
|-pic17.gif
|-pic18.gif
|-pic19.gif
|-pic21.gif
|-pic22.gif
|-pic23.gif
|-pic24.gif
|-pic25.gif
|-pic26.gif
|-pic5.gif
|-pic6.gif
|-pic7.gif
|-pic8.gif
|-pic9.gif
|-Redirects.gif
|-report2_(add).gif
|-report2_(delete).gif
|-right_smbg.jpg
|-servicezhgb2312.gif
|-set.gif
|-set2.gif
|-sitebackup.gif
|-skin.css
|-smallbg.jpg
|-st.gif
|-st.png
|-stop.gif
|-str.gif
|-Submit_bg.gif
|-t2bg1.gif
|-t2bg2.gif
|-t2bg4.gif
|-t2bg5.gif
|-Thumbs.db
|-title.gif
|-tj.jpg
|-to.gif
|-tool-down-pic.gif
|-toolbar
|-icon-delete.png
|-icon-edit.png
|-icon-help.png
|-icon-new.png
|-mainmenu.png
|-p.png
|-x.png
|-top-right.gif
|-top_bt.jpg
|-ts.gif
|-user-info.gif
|-usercontrol.gif
|-vie.gif
|-X.gif
|-yc.gif
|-yx.gif
|-js
|-jquery-1.3.2.min.js
|-moo.fx.js
|-moo.fx.pack.js
|-prototype.lite.js
|-left.html
|-login.html
|-main.html
|-success.html
|-top.html
|-Role
|-add.html
|-edit.html
|-index.html
|-Section
|-add.html
|-edit.html
|-helper.html
|-index.html
|-tpl.html
|-User
|-add.html
|-edit.html
|-index.html
|-index.html
|-admin.php
|-Attachments
|-config.inc.php
|-index.php
|-Install
|-17joyscms.sql
|-data.sql
|-images
|-logo.jpg
|-includes
|-config_rglobals.php
|-config_rglobals_magic.php
|-inc_install.php
|-index.php
|-installed.lock
|-templates
|-ajax2.js
|-jquery.js
|-s1.html
|-s2.html
|-s3.html
|-s4.html
|-style.css
|-tablebox.css
|-_database.inc.php
|-license.txt
|-Public
|-fckeditor
|-editor
|-css
|-behaviors
|-disablehandles.htc
|-showtableborders.htc
|-fck_editorarea.css
|-fck_internal.css
|-fck_showtableborders_gecko.css
|-images
|-block_address.png
|-block_blockquote.png
|-block_div.png
|-block_h1.png
|-block_h2.png
|-block_h3.png
|-block_h4.png
|-block_h5.png
|-block_h6.png
|-block_p.png
|-block_pre.png
|-fck_anchor.gif
|-fck_flashlogo.gif
|-fck_hiddenfield.gif
|-fck_pagebreak.gif
|-fck_plugin.gif
|-dialog
|-common
|-fck_dialog_common.css
|-fck_dialog_common.js
|-images
|-locked.gif
|-reset.gif
|-unlocked.gif
|-fck_about
|-logo_fckeditor.gif
|-logo_fredck.gif
|-sponsors
|-spellchecker_net.gif
|-fck_about.html
|-fck_anchor.html
|-fck_button.html
|-fck_checkbox.html
|-fck_colorselector.html
|-fck_div.html
|-fck_docprops
|-fck_document_preview.html
|-fck_docprops.html
|-fck_flash
|-fck_flash.js
|-fck_flash_preview.html
|-fck_flash.html
|-fck_form.html
|-fck_hiddenfield.html
|-fck_image
|-fck_image.js
|-fck_image_preview.html
|-fck_image.html
|-fck_link
|-fck_link.js
|-fck_link.html
|-fck_listprop.html
|-fck_paste.html
|-fck_radiobutton.html
|-fck_replace.html
|-fck_select
|-fck_select.js
|-fck_select.html
|-fck_smiley.html
|-fck_source.html
|-fck_specialchar.html
|-fck_spellerpages
|-spellerpages
|-blank.html
|-controls.html
|-controlWindow.js
|-server-scripts
|-spellchecker.cfm
|-spellchecker.php
|-spellchecker.pl
|-spellchecker.html
|-spellChecker.js
|-spellerStyle.css
|-wordWindow.js
|-fck_spellerpages.html
|-fck_table.html
|-fck_tablecell.html
|-fck_template
|-images
|-template1.gif
|-template2.gif
|-template3.gif
|-fck_template.html
|-fck_textarea.html
|-fck_textfield.html
|-dtd
|-fck_dtd_test.html
|-fck_xhtml10strict.js
|-fck_xhtml10transitional.js
|-fckdebug.html
|-fckdialog.html
|-fckeditor.html
|-fckeditor.original.html
|-filemanager
|-browser
|-default
|-browser.css
|-browser.html
|-frmactualfolder.html
|-frmcreatefolder.html
|-frmfolders.html
|-frmresourceslist.html
|-frmresourcetype.html
|-frmupload.html
|-images
|-ButtonArrow.gif
|-Folder.gif
|-Folder32.gif
|-FolderOpened.gif
|-FolderOpened32.gif
|-FolderUp.gif
|-icons
|-32
|-ai.gif
|-avi.gif
|-bmp.gif
|-cs.gif
|-default.icon.gif
|-dll.gif
|-doc.gif
|-exe.gif
|-fla.gif
|-gif.gif
|-htm.gif
|-html.gif
|-jpg.gif
|-js.gif
|-mdb.gif
|-mp3.gif
|-pdf.gif
|-png.gif
|-ppt.gif
|-rdp.gif
|-swf.gif
|-swt.gif
|-txt.gif
|-vsd.gif
|-xls.gif
|-xml.gif
|-zip.gif
|-ai.gif
|-avi.gif
|-bmp.gif
|-cs.gif
|-default.icon.gif
|-dll.gif
|-doc.gif
|-exe.gif
|-fla.gif
|-gif.gif
|-htm.gif
|-html.gif
|-jpg.gif
|-js.gif
|-mdb.gif
|-mp3.gif
|-pdf.gif
|-png.gif
|-ppt.gif
|-rdp.gif
|-swf.gif
|-swt.gif
|-txt.gif
|-vsd.gif
|-xls.gif
|-xml.gif
|-zip.gif
|-spacer.gif
|-js
|-common.js
|-fckxml.js
|-connectors
|-php
|-basexml.php
|-commands.php
|-config.php
|-connector.php
|-io.php
|-phpcompat.php
|-upload.php
|-util.php
|-test.html
|-uploadtest.html
|-images
|-anchor.gif
|-arrow_ltr.gif
|-arrow_rtl.gif
|-smiley
|-msn
|-angel_smile.gif
|-angry_smile.gif
|-broken_heart.gif
|-cake.gif
|-confused_smile.gif
|-cry_smile.gif
|-devil_smile.gif
|-embaressed_smile.gif
|-envelope.gif
|-heart.gif
|-kiss.gif
|-lightbulb.gif
|-omg_smile.gif
|-regular_smile.gif
|-sad_smile.gif
|-shades_smile.gif
|-teeth_smile.gif
|-thumbs_down.gif
|-thumbs_up.gif
|-tounge_smile.gif
|-whatchutalkingabout_smile.gif
|-wink_smile.gif
|-spacer.gif
|-js
|-fckadobeair.js
|-fckeditorcode_gecko.js
|-fckeditorcode_ie.js
|-lang
|-en-au.js
|-en-ca.js
|-en-uk.js
|-en.js
|-zh-cn.js
|-zh.js
|-_translationstatus.txt
|-plugins
|-autogrow
|-fckplugin.js
|-bbcode
|-fckplugin.js
|-_sample
|-sample.config.js
|-sample.html
|-dragresizetable
|-fckplugin.js
|-insertcodeRun
|-fckplugin.js
|-fck_insertcode.html
|-insertCode.css
|-insertcodePage.js
|-insertcodeRun.jpg
|-placeholder
|-fckplugin.js
|-fck_placeholder.html
|-lang
|-de.js
|-en.js
|-es.js
|-fr.js
|-it.js
|-pl.js
|-placeholder.gif
|-simplecommands
|-fckplugin.js
|-tablecommands
|-fckplugin.js
|-skins
|-default
|-fck_dialog.css
|-fck_dialog_ie6.js
|-fck_editor.css
|-fck_strip.gif
|-images
|-dialog.sides.gif
|-dialog.sides.png
|-dialog.sides.rtl.png
|-sprites.gif
|-sprites.png
|-toolbar.arrowright.gif
|-toolbar.buttonarrow.gif
|-toolbar.collapse.gif
|-toolbar.end.gif
|-toolbar.expand.gif
|-toolbar.separator.gif
|-toolbar.start.gif
|-office2003
|-fck_dialog.css
|-fck_dialog_ie6.js
|-fck_editor.css
|-fck_strip.gif
|-images
|-dialog.sides.gif
|-dialog.sides.png
|-dialog.sides.rtl.png
|-sprites.gif
|-sprites.png
|-toolbar.arrowright.gif
|-toolbar.bg.gif
|-toolbar.buttonarrow.gif
|-toolbar.collapse.gif
|-toolbar.end.gif
|-toolbar.expand.gif
|-toolbar.separator.gif
|-toolbar.start.gif
|-silver
|-fck_dialog.css
|-fck_dialog_ie6.js
|-fck_editor.css
|-fck_strip.gif
|-images
|-dialog.sides.gif
|-dialog.sides.png
|-dialog.sides.rtl.png
|-sprites.gif
|-sprites.png
|-toolbar.arrowright.gif
|-toolbar.buttonarrow.gif
|-toolbar.buttonbg.gif
|-toolbar.collapse.gif
|-toolbar.end.gif
|-toolbar.expand.gif
|-toolbar.separator.gif
|-toolbar.start.gif
|-_fckviewstrips.html
|-fckconfig.js
|-fckeditor.js
|-fckeditor.php
|-fckeditor_php4.php
|-fckeditor_php5.php
|-fckpackager.xml
|-fckstyles.xml
|-fcktemplates.xml
|-license.txt
|-index.html
|-readme.txt
|-siteconfig.inc.php
|-ThinkPHP
|-Common
|-alias.php
|-compat.php
|-convention.php
|-core.php
|-debug.php
|-defines.php
|-extend.php
|-functions.php
|-paths.php
|-runtime.php
|-index.html
|-Lang
|-zh-cn.php
|-Lib
|-ORG
|-Crypt
|-Base64.class.php
|-Crypt.class.php
|-Des.class.php
|-Rsa.class.php
|-Xxtea.class.php
|-Io
|-Dir.class.php
|-Net
|-Http.class.php
|-IpLocation.class.php
|-UploadFile.class.php
|-Util
|-ArrayList.class.php
|-CodeSwitch.class.php
|-Date.class.php
|-HashMap.class.php
|-Image.class.php
|-Input.class.php
|-Page.class.php
|-RBAC.class.php
|-Socket.class.php
|-Stack.class.php
|-String.class.php
|-Think
|-Core
|-Action.class.php
|-App.class.php
|-Log.class.php
|-Model
|-AdvModel.class.php
|-RelationModel.class.php
|-ViewModel.class.php
|-Model.class.php
|-Think.class.php
|-View.class.php
|-Db
|-Db.class.php
|-Driver
|-DbMysql.class.php
|-DbMysqli.class.php
|-Exception
|-ThinkException.class.php
|-Template
|-TagLib
|-TagLibCx.class.php
|-TagLibHtml.class.php
|-TagLib.class.php
|-Tags
|-cx.xml
|-html.xml
|-ThinkTemplate.class.php
|-Util
|-Behavior.class.php
|-Cache
|-CacheFile.class.php
|-Cache.class.php
|-Cookie.class.php
|-Debug.class.php
|-Dispatcher.class.php
|-HtmlCache.class.php
|-Session.class.php
|-Template
|-TemplateSmarty.class.php
|-TemplateThink.class.php
|-Widget.class.php
|-LICENSE.txt
|-Mode
|-Cli
|-Action.class.php
|-alias.php
|-App.class.php
|-cli.php
|-Lite
|-Action.class.php
|-alias.php
|-App.class.php
|-Db.class.php
|-Dispatcher.class.php
|-Model.class.php
|-lite.php
|-Thin
|-Action.class.php
|-alias.php
|-App.class.php
|-Db.class.php
|-Model.class.php
|-thin.php
|-ThinkPHP.php
|-Tpl
|-PageTrace.tpl.php
|-ThinkException.tpl.php
|-Vendor