본문 바로가기

Developement/Web Programming

파일의 퍼미션을 보기 좋게 구하기

 function get_perms($file){

                $perms = fileperms($file);

                $ans .= ($perms & 0x00004000) ? 'd' : '-'; //디렉토리인지 조사
                $ans .= ($perms & 0x00000100) ? 'r' : '-'; //Owner : 읽기
                $ans .= ($perms & 0x00000080) ? 'w' : '-'; //Owner : 쓰기
                $ans .= ($perms & 0x00000040) ? 'x' : '-'; //Owner : 실행
                $ans .= ($perms & 0x00000020) ? 'r' : '-'; //Group : 읽기
                $ans .= ($perms & 0x00000010) ? 'w' : '-'; //Group : 쓰기
                $ans .= ($perms & 0x00000008) ? 'x' : '-'; //Group : 실행
                $ans .= ($perms & 0x00000004) ? 'r' : '-'; //User : 읽기
                $ans .= ($perms & 0x00000002) ? 'w' : '-'; //User : 쓰기
                $ans .= ($perms & 0x00000001) ? '+ 'x' : '-'; //User : 실행

                return $ans;
        }

'Developement > Web Programming' 카테고리의 다른 글

논리적 흐름에 맞는 탭메뉴  (0) 2014.03.19
호환성보기 명령어  (0) 2014.03.19
계정 사용량 출력하기  (0) 2014.03.19
Mysql DB 사용량 출력  (0) 2014.03.19
정규식 문법  (0) 2014.03.19