手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表Tag:spl

Easy way to find a file in subdirectory with php

原文由双瞳翻译。(这里是简要,详情请看全文)

发布时间:08-02-18
原文:
Antoine Ughetto has posted an easy way to find a file inside any series of subdirectories with PHP:
I've made a previous post on SPL using RecursiveIterator to parse Array. Today we will use this same RecursiveIterator with a DirectoryRecursiveIterator.
The code is pretty simple and straight forward - a DirectorySearch class that takes in the directory name and recurses through the files and subdirectories to locate the file you're looking for.
译文:
Antoine Ughetto有个简便的方法,用PHP 来查找一堆子文件夹中的文件。
我先前在 SPL 上发过一篇关于用 RecursiveIterator 追踪数组的文章。现在我们将再次使用RecursiveIterator连同DirectoryRecursiveIterator。
代码相当简单明了-一个DirectorySearch类提取文件目录名称并递归所有文件和子目录, 定位查找文件。

» 阅读全文

Tags: php, spl