PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

filesize> <fileowner
Last updated: Sun, 25 Nov 2007

view this page in

fileperms

(PHP 4, PHP 5)

fileperms — 파일의 권한을 가져옵니다

Description

int fileperms ( string $filename )

파일의 권한을 반환하거나 실패할 경우에는 FALSE를 반환합니다.

이 함수의 실행결과는 캐시가 됩니다. 좀 더 자세한 내용을 알고 싶을때는 clearstatcache()를 참조하세요



filesize> <fileowner
Last updated: Sun, 25 Nov 2007
 
add a note add a note User Contributed Notes
fileperms
eelco
10-Jul-2007 02:21
If you only want the permissions (lowest three octal numbers) you can use a bitwise AND to mask the bits:

<?php
fileperms
($file) & 511;
?>
paul2712 at gmail dot com
02-Jun-2007 09:08
Do not forget: clearstatcache();
==============================
 
When ever you make a:

mkdir($dstdir, 0770 ))

or a:

chmod($dstdir, 0774 );

You have to call:

clearstatcache();

before you can call:

fileperms($dstdir);
chinello at gmail dot com
24-Apr-2007 09:43
On Linux (not tested on Windows), if you want a chmod-like permissions, you can use this function:

<?php
function file_perms($file, $octal = false)
{
    if(!
file_exists($file)) return false;

   
$perms = fileperms($file);

   
$cut = $octal ? 2 : 3;

    return
substr(decoct($perms), $cut);
}
?>

Using it:

$ touch foo.bar
$ chmod 0754 foo.bar
<?php
echo file_perms('foo.bar'); // prints: 754
echo file_perms('foo.bar', true); // prints 0754
?>

filesize> <fileowner
Last updated: Sun, 25 Nov 2007
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites