2018년 1월 14일 일요일

[php] 현재폴더(디렉토리)명 추출

[php] 현재폴더(디렉토리)명 추출

파일명 바로 앞 폴더명을 추출시 사용


//php 바로위 폴더이름 알아내기 
function get_dirname() {
 $dir = getcwd(); // 현재 디렉토리명을 반환하는 PHP 함수이다.
 $temp = explode("/", $dir);
 $dirname = $temp[sizeof($temp)-1];
 return $dirname;
}

[출처] http://qkrrjsgh.tistory.com/51
Share:

0 개의 댓글:

댓글 쓰기