php 특정파일 전부만 출력하고 싶은데요

php 특정파일 전부만 출력하고 싶은데요

QA

php 특정파일 전부만 출력하고 싶은데요

답변 1

본문

특정 파일(index.html)을 전부 뽑을건데요 디렉토리가 트리구조로 되어있어요 3개로

/test/test1/restest/index.php

예를 들어서 이런식인데요 여기서 파일이랑 폴더가 여러가지인데 특정파일(.html)만 뽑아오고 싶어요 

 

소스는 여기서 http://dol2156.tistory.com/239 본게 있는데요 이건 다 뽑아 오는거라서.. 

.html만 하려고요 ㅎㅎ

 

이 질문에 댓글 쓰기 :

답변 1

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
© SIRSOFT
현재 페이지 제일 처음으로