 |
file (PHP 3, PHP 4, PHP 5) file -- Legge l'intero file in un vettore Descrizionearray file ( string filename [, int use_include_path [, resource context]] )
Identica a readfile(), eccetto per il fatto che
file() restituisce il file in un vettore. Ogni
elemento del vettore corrisponde ad una riga del file, con il carattere di
newline ancora inserito. Se la funzione non riesce restituisce
FALSE.
Puoi impostare il secondo parametro, use_include_path, (opzionale) ad "1",
se vuoi cercare il file nel include_path.
Suggerimento: È possibile utilizzare una URL come un
nome di file con questa funzione se fopen wrappers è stata abilitata.
Per maggiori informazioni su come specificare i nomi di file vedere fopen()
e Appendice M per avere la lista dei protocolli URL
supportati.
Nota:
Ciascuna riga dell'array restituito conterrà il carattere di fine riga, occorre, pertanto,
utilizzare rtrim() se si desidera rimuovere il carattere
di fine riga.
Nota: Se il PHP ha
dei problemi a riconoscere la fine riga nella lettura di file su
o creati da computer Macintosh, si può abilitare il parametro
di configurazione auto_detect_line_endings.
Nota:
A partire da PHP 4.3.0 si può utilizzare file_get_contents() per
memorizzare il contenuto di un file in una stringa in formato binario.
Avvertimento | When using SSL, Microsoft IIS
will violate the protocol by closing the connection without sending a
close_notify indicator. PHP will report this as "SSL: Fatal Protocol Error"
when you reach the end of the data. To workaround this, you should lower your
error_reporting level not to include warnings.
PHP 4.3.7 and higher can detect buggy IIS server software when you open
the stream using the https:// wrapper and will suppress the warning for you.
If you are using fsockopen() to create an ssl:// socket,
you are responsible for detecting and suppressing the warning yourself.
|
Vedere anche readfile(),
fopen(), fsockopen(),
popen(), file_get_contents() e
include().
|  |