Compzone.Org :: Podręcznik PHP :: is_readable
Pytania w drugiej edycji Testu PHP powinny być:
Trudniejsze
Łatwiejsze
Skomplikowane
Na myślenie
Do liczenia
Sonda Wyniki

Add to Google

is_readable

(PHP 3, PHP 4, PHP 5)

is_readable -- Tells whether the filename is readable

Description

bool is_readable ( string filename )

Returns TRUE if the file or directory specified by filename exists and is readable.

Keep in mind that PHP may be accessing the file as the user id that the web server runs as (often 'nobody'). Safe mode limitations are not taken into account.

Przykład 1. is_readable() example

<?php
$filename 
'test.txt';
if (
is_readable($filename)) {
    echo 
'The file is readable';
} else {
    echo 
'The file is not readable';
}
?>

Notatka: Wyniki działania tej funkcji są buforowane. Zobacz opis funkcji clearstatcache() aby uzyskać więcej informacji.

Podpowiedź: Od wersji 5.0.0 PHP ta funkcja może być użyta także z niektórymi wrapperami URL. Zobacz Dodatek M aby uzyskać listę wrapperów które obsługują funkcjonalność z rodziny stat().

See also is_writable(), file_exists(), and fgets().

Copyright © 2005-2006 Compzone.Org. Kopiowanie i wykorzystywanie materiałów zawartych na tej stronie bez zgody autora zabronione!