특정 파일(index.html)을 전부 뽑을건데요 디렉토리가 트리구조로 되어있어요 3개로
/test/test1/restest/index.php
예를 들어서 이런식인데요 여기서 파일이랑 폴더가 여러가지인데 특정파일(.html)만 뽑아오고 싶어요
소스는 여기서 http://dol2156.tistory.com/239 본게 있는데요 이건 다 뽑아 오는거라서..
.html만 하려고요 ㅎㅎ
|
답변 1개 / 댓글 2개
채택된 답변
+20 포인트
2017-12-02 (토) 17:22:43
function rglob($pattern) {
$files = glob($pattern);
foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR) as $dir)
$files = array_merge($files, rglob($dir.'/'.basename($pattern)));
return $files;
}
$files = rglob('*.html');
답변에 대한 댓글 2개
답변을 작성하려면 로그인이 필요합니다.