디렉토리의 모든 파일을 읽어 목록으로 만들기 입니다.

· 10년 전 · 1051

function listFile($dir, $file_type)
 {
 chdir($dir);
 if (!$file_type)
 $ls_str = " ls -R * ";
 else
 $ls_str = " ls -R *." . $file_type;

 $fp = popen($ls_str, "r");
 while(!feof($fp)){
 $line = fgets($fp,50);
 $line = trim($line);

 if(substr($line,strlen($line)-1,1) == ":"){ //디렉토리 처리부분
$subdir = $line;
 $subdir = substr($subdir,0,strlen($line)-1) . "/";
 }

 $htmlfile = explode(".",$line); //html파일 처리부분
if($htmlfile[1] == "html"){
 $fullpath = $subdir . $line;
 }
 }
 pclose($fp);
 return $fullpath;
 }  

|
댓글을 작성하시려면 로그인이 필요합니다.

토크

개발과 관련된 어떤 얘기도 괜찮습니다.

+
제목 글쓴이 날짜 조회
9년 전 조회 1,253
9년 전 조회 1,606
10년 전 조회 2,032
10년 전 조회 1,286
10년 전 조회 1,758
10년 전 조회 1,188
10년 전 조회 1,904
10년 전 조회 1,592
10년 전 조회 1,412
10년 전 조회 1,804
9년 전 조회 1,332
9년 전 조회 1,171
10년 전 조회 1,220
10년 전 조회 1,317
10년 전 조회 1,052
10년 전 조회 959
10년 전 조회 1,199
10년 전 조회 1,019
10년 전 조회 1,049
10년 전 조회 1,171
10년 전 조회 1,165
10년 전 조회 1,168
10년 전 조회 998
10년 전 조회 1,370
10년 전 조회 1,096
10년 전 조회 987
10년 전 조회 971
10년 전 조회 945
10년 전 조회 1,412
10년 전 조회 1,444