file() (funzione PHP) legge un intero file e restituisce un array numerico, di cui ogni elemento è una riga del file stesso.
tips&tricks
Sintassi
file($file, $opzioni[facoltativo])
| parametro | descrizione |
|---|---|
| $file | Il file da processare |
| $opzioni | Le opzioni di letture, secondo i seguenti valori testuali:FILE_USE_INCLUDE_PATH Search for the file in the include_path.FILE_IGNORE_NEW_LINES Do not add newline at the end of each array elementFILE_SKIP_EMPTY_LINES Skip empty lines
|
Esempi
print_r(file("prova.txt"));
/* RISULTATO
Array
(
[0] => Prima riga del file.
[1] => Seconda riga del file.
[2] => Terza riga del file
)
*/
Contenuti correlati
- CSS
- HTML
- JavaScript
- jQuery
- PHP
- SQL
- WORDPRESS
0 Comment