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

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;
 }  

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

팁게시판

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
9년 전 조회 121
9년 전 조회 109
9년 전 조회 123
9년 전 조회 185
9년 전 조회 144
9년 전 조회 288
9년 전 조회 192
9년 전 조회 222
9년 전 조회 199
9년 전 조회 157
9년 전 조회 170
9년 전 조회 282
9년 전 조회 180
9년 전 조회 201
9년 전 조회 299
9년 전 조회 242
9년 전 조회 179
9년 전 조회 231
9년 전 조회 162
9년 전 조회 162
9년 전 조회 219
9년 전 조회 165
9년 전 조회 212
9년 전 조회 187
9년 전 조회 539
🐛 버그신고