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

search for in the

fileperms> <filemtime
Last updated: Fri, 06 Nov 2009

view this page in

fileowner

(PHP 4, PHP 5)

fileownerファイルの所有者を取得する

説明

int fileowner ( string $filename )

ファイルの所有者を取得します。

パラメータ

filename

ファイルへのパス。

返り値

ファイルの所有者のユーザ ID を返し、エラーの場合は FALSE を返します。 ユーザ ID は数値で返されます。ユーザ名に変換するには posix_getpwuid() を使用してください。

例1 ファイルの所有者の取得

<?php
$filename 
'index.php';
print_r(posix_getpwuid(fileowner($filename)));
?>

注意

注意: この関数の結果は キャッシュされます。詳細は、clearstatcache() を参照してください。

ヒント

PHP 5.0.0 以降、この関数は、 何らかの URL ラッパーと組合せて使用することができます。 どのラッパーが stat() ファミリーをサポートしているか のリストについては、サポートするプロトコル/ラッパー を参照してください。

参考

  • filegroup() - ファイルのグループを取得する
  • stat() - ファイルに関する情報を取得する
  • posix_getpwuid() - 指定 ID のユーザに関する情報を返す



add a note add a note User Contributed Notes
fileowner
joacorck at gmail dot com
26-Feb-2007 01:20
This function only works if the permissions are more less than 666
29-Jan-2006 12:58
Small note: the function resolves symbolic links. That is, if the link is created by user 999 and maps to a file owned by user 666, this function returns 666 :(

fileperms> <filemtime
Last updated: Fri, 06 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites