"PHP fileperms()"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-<source lang='cli'> +<source lang='console'>))
잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(같은 사용자의 중간 판 하나는 보이지 않습니다)
4번째 줄: 4번째 줄:


==예시 1==
==예시 1==
<source lang='console'>
<syntaxhighlight lang='console'>
root@zetawiki:~# stat -c%A /etc/passwd
root@zetawiki:~# stat -c%A /etc/passwd
-rw-r--r--
-rw-r--r--
root@zetawiki:~# stat -c%a /etc/passwd
root@zetawiki:~# stat -c%a /etc/passwd
644
644
</source>
</syntaxhighlight>
<source lang='php'>
<syntaxhighlight lang='php'>
var_dump( fileperms('/etc/passwd') );
var_dump( fileperms('/etc/passwd') );
# int(33188)
# int(33188)
19번째 줄: 19번째 줄:
var_dump( decoct(fileperms('/etc/passwd') & 0777) );
var_dump( decoct(fileperms('/etc/passwd') & 0777) );
# string(3) "644"
# string(3) "644"
</source>
</syntaxhighlight>


==예시 2==
==예시 2==
<source lang='console'>
<syntaxhighlight lang='console'>
root@zetawiki:~# stat -c%A /tmp
root@zetawiki:~# stat -c%A /tmp
drwxrwxrwt
drwxrwxrwt
root@zetawiki:~# stat -c%a /tmp
root@zetawiki:~# stat -c%a /tmp
1777
1777
</source>
</syntaxhighlight>
<source lang='php'>
<syntaxhighlight lang='php'>
var_dump( fileperms('/tmp') );
var_dump( fileperms('/tmp') );
# int(17407)
# int(17407)
37번째 줄: 37번째 줄:
var_dump( decoct(fileperms('/tmp') & 0777) );
var_dump( decoct(fileperms('/tmp') & 0777) );
# string(3) "777"
# string(3) "777"
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==
46번째 줄: 46번째 줄:
*[[퍼미션]]
*[[퍼미션]]


==참고 자료==
==참고==
* http://php.net/manual/en/function.fileperms.php
* http://php.net/manual/en/function.fileperms.php


[[분류: PHP]]
[[분류: PHP]]
[[분류: 파일]]
[[분류: 파일]]

2020년 11월 2일 (월) 02:34 기준 최신판

1 개요[ | ]

PHP fileperms()
  • 파일(또는 폴더)의 퍼미션을 조회하는 PHP 함수

2 예시 1[ | ]

root@zetawiki:~# stat -c%A /etc/passwd
-rw-r--r--
root@zetawiki:~# stat -c%a /etc/passwd
644
var_dump( fileperms('/etc/passwd') );
# int(33188)
var_dump( decoct(fileperms('/etc/passwd')) );
# string(6) "100644"
var_dump( decoct(fileperms('/etc/passwd') & 07777) );
# string(3) "644"
var_dump( decoct(fileperms('/etc/passwd') & 0777) );
# string(3) "644"

3 예시 2[ | ]

root@zetawiki:~# stat -c%A /tmp
drwxrwxrwt
root@zetawiki:~# stat -c%a /tmp
1777
var_dump( fileperms('/tmp') );
# int(17407)
var_dump( decoct(fileperms('/tmp')) );
# string(5) "41777"
var_dump( decoct(fileperms('/tmp') & 07777) );
# string(4) "1777"
var_dump( decoct(fileperms('/tmp') & 0777) );
# string(3) "777"

4 같이 보기[ | ]

5 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}