Loading:


stat
array stat ( string $filename )


Podaje statystyki pliku o nazwie podanej w parametrze $filename,

Gathers the statistics of the file named by filename .


Parametry

 

filename  - Ścieżka do pliku


Zwracane wartości

 


NUmer wartosc opis
0 dev numer urządzenia
1 ino numer węzła
2 mode węzeł w trybie ochrony
3 nlink liczba dowiązań
4 uid userid właściciela
5 gid grupa właścicieli *
6 rdev typ urządzenia
7 size rozmiar w bajtach
8 atime ostatni czas dostępu
9 mtime ostatni czas modyfikacji
10 ctime ostatni czas zmiany wezła
11 blksize blocksize of filesystem IO **
12 blocks ilosć alokacji bloków




Napisz Artyku³

Listing


//Przykład #1 stat() example
<?php
/* pobieramy statystyki plików */
$stat = stat('C:\php\php.exe');

/*
 * Print file access file, this is the same
 * as calling fileatime()
 */

echo 'Access time: ' . $stat['atime'];

/*
 * Print file modification time, this is the
 * same as calling filemtime()
 */

echo 'Modification time: ' . $stat['mtime'];

/* Print the device number */
echo 'Device number: ' . $stat['dev'];





//Przykład #2 Using stat() information together with touch()
<?php
/* Get file stat */
$stat = @stat('C:\php\php.exe');

/* Did we failed to get stat information ? */
if(!$stat)
{
    echo 'Stat call failed...';
}
else
{
    /*
     * We want the access time to be 1 week
     * before the current access time.
     */

    $atime = $stat['atime'] + 604800;

    /* Touch the file */
    if(!@touch('some_file.txt', time(), $atime))
    {
        echo 'Failed to touch file...';
    }
    else
    {
        echo 'Touch returned success...';
    }
}
?>
 




Dodano przez: igor
Ranga: Administrator serwisu Punktów: 28716
Komentarze użytkowników
    • Tre¶æ komentarza
      Kod do komentarza (opcjonalnie)
      PHP JavaScript MySQL Smarty SQL HTML CSS ActionScript
      Autor
      Token
      token

       

       








funkcje.net
Wszelkie prawa zastrzeżone©. | Funkcje.net 2008-2024 v.1.5 | design: diviXdesign & rainbowcolors