| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> php >> yong PHP5 de DirectoryIterators di gui sao miao mu lu
 

yong PHP5 de DirectoryIterators di gui sao miao mu lu

2008-12-28 07:39:41 编辑來源:互联网 评论
 
本文为【用PHP5的DirectoryIterators递归扫描目录】的拼音翻译版
  PHP5 zhong zeng jia le Iterator, yi zu you zhu yu dao hang he chu li deng ji shu ju jie gou de xian cheng jie kou , zhe shi PHP5 zui you qu de xin te xing zhi yi 。
  zhe xie Iterator xian zhu jian shao le chu li XML wen dang shu huo wen jian ji he suo xu de dai ma 。PHP5 zhong shi yong da liang Iterator, bao kuo ArrayIterator、 CachingIterator、LimitIterator、RecursiveIterator、SimpleXMLIterator he DirectoryIterator。
  tong guo DirectoryIterator ke yi xun su you xiao di dui mu lu zhong de wen jian jin xing chu li 。 zai bian ma guo cheng zhong shao wei zeng jia yi xie chuang zao li ,DirectoryIterator huan ke yong yu di gui chu li qian tao shi mu lu shu 。 zhe liang ge ren wu zhi xu shi yong ji xing dai ma jiu ke yi wan cheng , bi “ biao zhun ” chu li fang fa you le xian zhu ti gao 。
  chu li dan ji mu lu
  shou xian wo men cong jian dan de ren wu zhe shou : chu li yi ge dan ji mu lu 。 shu ru ( huo fu zhi ) yi xia dai ma ( lie biao A), xiu gai mu lu lu jing yi fan yang dang di pei zhi :
  lie biao A
  <?php$it = new DirectoryIterator("/tmp/mystuff");foreach($it as $file) {if (!$it->isDot()) {echo $file . "n";}}?> zai liu lan qi zhong cha kan zhe duan dai ma de shu chu jie guo , ni hui zai zhi ding mu lu zhong kan dao yi ge wen jian lie biao 。 zhe yi qie shi ru he fa sheng de ne ?DirectoryIterator ti gong yi ge yu xian que ding de jie kou lai chong shu yi ge mu lu de nei rong ; shi li mu biao mu lu de wei zhi hou , jiu ke yi ba ta dang zuo yi ge biao zhun de PHP shu zu lai chu li , mei ge yuan su dai biao mu lu zhong de yi ge wen jian 。 zhu yi ta shi yong isDot () fang fa fen bie guo lv diao “.” he “..” mu lu 。
  chu li qian tao shi mu lu shu
  di gui chu li yi ge qian tao shi mu lu shu ji hu tong yang jian dan 。 zai zhe zhong qing kuang xia ,DirectoryIterator xu yao jian cha ta zai dan ji mu lu zhong yu dao de mei yi ge dui xiang , que ding qi shi yi ge wen jian huan shi mu lu 。 ru guo shi yi ge mu lu , jiu geng shen ru yi ji jian yan xia yi ji de nei rong 。 zhe ting qi lai si hu xiang dang fu duo , zai guo qu yi ban dou xu yao 15 xing yi shang de dai ma 。
  dan shi , shi yong PHP5, ni zhi xu yao liang ge xin de Iterator:RecursiveIterator he RecursiveIteratorIterator, ta men zu he le suo you shang shu gong neng 。 jian lie biao B:
  lie biao B
  <?php$it = new RecursiveDirectoryIterator("/tmp");foreach(new RecursiveIteratorIterator($it) as $file) {echo $file . "n";}?> zhe shi , shu ru jie guo jiang lie chu qi shi mu lu xia de suo you wen jian he mu lu 。 bu bi shuo , ru guo xu yao chu li mou ge te ding mu lu ji xia de suo you wen jian —— li ru , di gui ya suo yi ge mu lu shu ; huo xiu gai yi xi lie qian tao wen jian de zu / suo you zhe xu ke shi —— shi yong zhe zhong di gui nei zhi jie kou jiu fei chang fang bian 。
  xian shi ying yong : da yin yi ge mu lu shu
  da yin tu xing mu lu shu shi mu lu di gui de yi ge chang jian ying yong 。 li yong Iterator chu li zhe ge ren wu shi fen jian dan , yin wei Iterator lei wen dang zhong bao han yi ge zhuan men wei zhe ge ying yong er bian xie de shi li lei 。DirectoryTreeIterator( gan xie Marcus Boerger) wei qian mian tao lun de RecursiveIteratorIterator ti gong le qi ta gai jin , te bie shi zai shu jie gou zhong dai biao shen du he wei zhi de ASCII biao ji 。
  lie biao C shuo ming le DirectoryTreeIterator de yong fa 。
  lie biao C
  <?php$it = new DirectoryTreeIterator("/tmp/cookbook/");foreach($it as $path) {echo $path . "n";}?> yi xia shi ni kan dao de yi bu fen shu chu jie guo :
  |-ch01| |-recipe01| | |-example01.php| | -example02.php| |-recipe02| | |-example01.php| | -example02.php| |-recipe03| | -example01.php... wei geng hao le jie zhe xie DirectoryIterator de jia zhi , chang shi yong biao zhun de wen jian he mu lu han shu dui ben jiao cheng zhong shuo ming de san ge ying yong bian ma 。【原文】【汉音对照
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
PHP5 zhong zeng jia le Iterator, yi zu you zhu yu dao hang he chu li deng ji shu ju jie gou de xian cheng jie kou , zhe shi PHP5 zui you qu de xin te xing zhi yi 。 zhe xie Iterator xian zhu jian shao le chu li XML wen dang shu huo wen jian ji he suo xu de dai ma 。PHP5 zhong shi yong da liang Iterator, bao kuo ArrayIterator、 CachingIterator、LimitIterator、RecursiveIterator、SimpleXMLIterator he DirectoryIterator。 tong guo DirectoryIterator ke yi xun su you xiao di dui mu lu zhong de wen jian jin xing chu li 。 zai bian ma guo cheng zhong shao wei zeng jia yi xie chuang zao li ,DirectoryIterator huan ke yong yu di gui chu li qian tao shi mu lu shu 。 zhe liang ge ren wu zhi xu shi yong ji xing dai ma jiu ke yi wan cheng , bi “ biao zhun ” chu li fang fa you le xian zhu ti gao 。 chu li dan ji mu lu shou xian wo men cong jian dan de ren wu zhe shou : chu li yi ge dan ji mu lu 。 shu ru ( huo fu zhi ) yi xia dai ma ( lie biao A), xiu gai mu lu lu jing yi fan yang dang di pei zhi : lie biao A <?php$it = new DirectoryIterator("/tmp/mystuff");foreach($it as $file) {if (!$it->isDot()) {echo $file . "n";}}?> zai liu lan qi zhong cha kan zhe duan dai ma de shu chu jie guo , ni hui zai zhi ding mu lu zhong kan dao yi ge wen jian lie biao 。 zhe yi qie shi ru he fa sheng de ne ?DirectoryIterator ti gong yi ge yu xian que ding de jie kou lai chong shu yi ge mu lu de nei rong ; shi li mu biao mu lu de wei zhi hou , jiu ke yi ba ta dang zuo yi ge biao zhun de PHP shu zu lai chu li , mei ge yuan su dai biao mu lu zhong de yi ge wen jian 。 zhu yi ta shi yong isDot () fang fa fen bie guo lv diao “.” he “..” mu lu 。 chu li qian tao shi mu lu shu di gui chu li yi ge qian tao shi mu lu shu ji hu tong yang jian dan 。 zai zhe zhong qing kuang xia ,DirectoryIterator xu yao jian cha ta zai dan ji mu lu zhong yu dao de mei yi ge dui xiang , que ding qi shi yi ge wen jian huan shi mu lu 。 ru guo shi yi ge mu lu , jiu geng shen ru yi ji jian yan xia yi ji de nei rong 。 zhe ting qi lai si hu xiang dang fu duo , zai guo qu yi ban dou xu yao 15 xing yi shang de dai ma 。 dan shi , shi yong PHP5, ni zhi xu yao liang ge xin de Iterator:RecursiveIterator he RecursiveIteratorIterator, ta men zu he le suo you shang shu gong neng 。 jian lie biao B: lie biao B <?php$it = new RecursiveDirectoryIterator("/tmp");foreach(new RecursiveIteratorIterator($it) as $file) {echo $file . "n";}?> zhe shi , shu ru jie guo jiang lie chu qi shi mu lu xia de suo you wen jian he mu lu 。 bu bi shuo , ru guo xu yao chu li mou ge te ding mu lu ji xia de suo you wen jian —— li ru , di gui ya suo yi ge mu lu shu ; huo xiu gai yi xi lie qian tao wen jian de zu / suo you zhe xu ke shi —— shi yong zhe zhong di gui nei zhi jie kou jiu fei chang fang bian 。 xian shi ying yong : da yin yi ge mu lu shu da yin tu xing mu lu shu shi mu lu di gui de yi ge chang jian ying yong 。 li yong Iterator chu li zhe ge ren wu shi fen jian dan , yin wei Iterator lei wen dang zhong bao han yi ge zhuan men wei zhe ge ying yong er bian xie de shi li lei 。DirectoryTreeIterator( gan xie Marcus Boerger) wei qian mian tao lun de RecursiveIteratorIterator ti gong le qi ta gai jin , te bie shi zai shu jie gou zhong dai biao shen du he wei zhi de ASCII biao ji 。 lie biao C shuo ming le DirectoryTreeIterator de yong fa 。 lie biao C <?php$it = new DirectoryTreeIterator("/tmp/cookbook/");foreach($it as $path) {echo $path . "n";}?> yi xia shi ni kan dao de yi bu fen shu chu jie guo : |-ch01| |-recipe01| | |-example01.php| | -example02.php| |-recipe02| | |-example01.php| | -example02.php| |-recipe03| | -example01.php... wei geng hao le jie zhe xie DirectoryIterator de jia zhi , chang shi yong biao zhun de wen jian he mu lu han shu dui ben jiao cheng zhong shuo ming de san ge ying yong bian ma 。
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
追忆.绯红色的审判
新竹的果子风
热裤女孩
凯宾斯基酒店随拍
金色草原
菜园小品
情人谷
广东惠州—巽寮湾的海景
 
>>返回首页<<
 为你推荐
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
©2005- 王朝网络 版权所有