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

search for in the

filegroup> <fileatime
Last updated: Sat, 24 Mar 2007

view this page in

filectime

(PHP 4, PHP 5)

filectime — Vrací čas změny inodu souboru

Popis

int filectime ( string $filename )

Vrací čas poslední změny inodu souboru, při chybě FALSE. Čas je vracen jako Unix timestamp.

Výsledek této funkce je cachován. Více informací - viz clearstatcache().

Pozn.: Na většině unixových filesystémů platí, že soubor je považován za změněný, pokud jsou změněna data v Inodu, tj. přístupová práva, vlastník, skupina nebo jiná metadata jsou zapsána do Inodu. filemtime() (toto je to, co chcete použít, když chcete vytvořit údaj "Poslední změna" na WWW stránce) a fileatime().

Pozn.: Na některých Unixech je ctime považován za čas vytvoření souboru. To je chyba. Na většině unixových filesystémů neexistuje žádný čas vytvoření unixových souborů.



filegroup> <fileatime
Last updated: Sat, 24 Mar 2007
 
add a note add a note User Contributed Notes
filectime
StevieMc at example dot com
15-Nov-2006 06:28
This method gets all the files in a directory, and echoes them in the order of the date they were added (by ftp or whatever).

<?PHP
function dirList ($directory, $sortOrder){

   
//Get each file and add its details to two arrays
   
$results = array();
   
$handler = opendir($directory);
    while (
$file = readdir($handler)) { 
        if (
$file != '.' && $file != '..' && $file != "robots.txt" && $file != ".htaccess"){
           
$currentModified = filectime($directory."/".$file);
           
$file_names[] = $file;
           
$file_dates[] = $currentModified;
        }   
    }
      
closedir($handler);

   
//Sort the date array by preferred order
   
if ($sortOrder == "newestFirst"){
       
arsort($file_dates);
    }else{
       
asort($file_dates);
    }
   
   
//Match file_names array to file_dates array
   
$file_names_Array = array_keys($file_dates);
    foreach (
$file_names_Array as $idx => $name) $name=$file_names[$name];
   
$file_dates = array_merge($file_dates);
   
   
$i = 0;

   
//Loop through dates array and then echo the list
   
foreach ($file_dates as $file_dates){
       
$date = $file_dates;
       
$j = $file_names_Array[$i];
       
$file = $file_names[$j];
       
$i++;
           
        echo 
"File name: $file - Date Added: $date. <br/>"";       
    }

}
?>

I hope this is useful to somebody.
gyrbo[at]yahoo[dot]com
21-Sep-2002 04:35
filectime doesn't seem to be working properly on Win32 systems (it seems to return the creation time). Try using filemtime if you have problems.
laurent dot pireyn at wanadoo dot be
27-Sep-2001 05:01
If you use filectime with a symbolic link, you will get the change time of the file actually linked to. To get informations about the link self, use lstat.

filegroup> <fileatime
Last updated: Sat, 24 Mar 2007
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites