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, 20 May 2011

view this page in

fileowner

(PHP 4, PHP 5)

fileownerObtiene el propietario de un archivo

Descripción

int fileowner ( string $filename )

Obtiene el propietario del archivo.

Parámetros

filename

Ruta del archivo.

Valores devueltos

Devuelve el ID de usuario del propietario del archivo, o FALSE en caso de error. El ID de usuario es devuelto en formato numérico, use posix_getpwuid() para resolverlo a un nombre de usuario.

Ejemplos

Example #1 Encontrar el propietario de un archivo

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

Errores/Excepciones

En caso de fallo, se emite un E_WARNING.

Notas

Note: Los resultados de esta función son guardados en caché. Para más información ver clearstatcache().

Tip

Desde PHP 5.0.0, esta función también puede usarse con algunos URL wrappers. Consultar Protocolos y Envolturas soportados para obtener una lista los wrappers tienen soporte para la familia de funcionalidad de stat().

Ver también



fileperms> <filemtime
Last updated: Fri, 20 May 2011
 
add a note add a note User Contributed Notes fileowner
dazoe 28-Jun-2010 02:21
Remember to use if(fileowner(...) === FALSE) instead of if(!fileowner()) or if(fileowner() == FLASE) because if the owner was "root" it would return 0.
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 :(

 
show source | credits | stats | sitemap | contact | advertising | mirror sites