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

search for in the

filectime> <file
Last updated: Fri, 13 Nov 2009

view this page in

fileatime

(PHP 4, PHP 5)

fileatimeObtém o último horário de acesso do arquivo

Descrição

int fileatime ( string $nomedoarquivo )

Obtém o último horário de acesso de um dado arquivo.

Parâmetros

filename

Path to the file.

Valor Retornado

Returns the time the file was last accessed, or FALSE in case of an error. The time is returned as a Unix timestamp.

Exemplos

Exemplo #1 Exemplo de fileatime()

<?php

// Exibe algo como: arquivo.txt teve o ultimo acesso em: December 29 2002 22:16:23.

$filename 'arquivo.txt';
if (
file_exists($filename)) {
    echo 
"$filename teve o ultimo acesso em: " date ("F d Y H:i:s."fileatime($filename));
}

?>

Notas

Nota: O atime de um arquivo é modificado sempre que blocos de dados de um arquivo são lidos. Isto pode ser performance custosa quando uma aplicação regularmente acessa um grande número de arquivos ou diretórios.
Alguns sistemas de arquivos Unix podem ser montados com atualização de atime desabilitada para aumentar a peformance de cada aplicação; USENET news spools é um exemplo comum. Nestes sistemas de arquivos esta função é inútil.

Nota: O resultado desta função é cacheada. Veja clearstatcache() para mais detalhes.

Dica

A partir do PHP 5.0.0, esta função também pode ser utilizada com alguns wrappers URL. Veja List of Supported Protocols/Wrappers para uma lista de quais wrappers são suportados pela família de funções stat().

Veja Também



add a note add a note User Contributed Notes
fileatime
Tyler at visualbits dot net
16-Dec-2008 07:42
This only applys to the FAT filesystem, ntfs and greater have file access time support.

Be careful with this function it can degrade script performance if checking several files.
Maulwurf
10-Oct-2004 04:12
Using this function on Win98 made me grow grey hair.
Win 98 doesn't save the time for the last access. It only saves the date. This way, the returned timestamp from fileatime(file) is always much too small.

this command will always return false:

if($now - $last_access >1800) {
do something
}

using filemtime() instead did the thing.

filectime> <file
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites