From 4540819f01bbbada4503ec5fc7f7ee9e988aad09 Mon Sep 17 00:00:00 2001 From: Manuel della Gala <74384683+ManueldG@users.noreply.github.com> Date: Sat, 8 Feb 2025 11:33:01 +0100 Subject: [PATCH 1/7] updated reference/filesystem/functions/file.xml --- reference/filesystem/functions/file.xml | 259 ++++++++++++++++++------ 1 file changed, 194 insertions(+), 65 deletions(-) diff --git a/reference/filesystem/functions/file.xml b/reference/filesystem/functions/file.xml index 6dfdb87d3..62e5b95f5 100644 --- a/reference/filesystem/functions/file.xml +++ b/reference/filesystem/functions/file.xml @@ -1,76 +1,205 @@ - - - - - - file - Legge l'intero file in un vettore - - - Descrizione - - arrayfile - stringfilename - intuse_include_path - resourcecontext - - - 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. - - - - + + + + + + file + Legge l'intero file in un array + + + + &reftitle.description; + + arrayfalsefile + stringfilename + intflags0 + resourcenullcontext&null; + + + Legge l'intero file in un array. + + + + In alternativa puoi usare file_get_contents per estrarre il contenuto + di un file sottoforma di stringa. + + + + + + &reftitle.parameters; + + + + filename + + + Percorso del file. + + &tip.fopen-wrapper; + + + + flags + + + Il parametro opzionale flags può essere uno, o + più valori, delle seguenti costanti: + + + + FILE_USE_INCLUDE_PATH + + + + Cerca il file in include_path. + + + + + + FILE_IGNORE_NEW_LINES + + + + Ometterà newline alla fine di ogni elemento dell'array + + + + + + FILE_SKIP_EMPTY_LINES + + + + Salta le righe vuote + + + + + + FILE_NO_DEFAULT_CONTEXT + + + + Non usa il context di default + + + + + + + + + context + + ¬e.context-support; + + + + + + + + &reftitle.returnvalues; + + Restituisce il file in un array. Ogni elemento dell'array corrisponde a una + riga nel file, con newline incluso. In caso di errore, + file restituisce &false;. + + + + Per ogni linea riportata nell'array risultante includerà newline, a meno + che non venga usato FILE_IGNORE_NEW_LINES. + + + ¬e.line-endings; + + + + &reftitle.errors; + + A partire da PHP 8.3.0, genera un ValueError + se flags include valori non validi, come + FILE_APPEND. + + + Emette un E_WARNING a livello d'errore + se il file non esiste. + + + + + &reftitle.changelog; + + + + + &Version; + &Description; + + + + + 8.3.0 + + ValueError viene generato + per qualunque valore di flags non valido. + + + + + + + + + &reftitle.examples; + + + <function>file</function> esempio + $line) { + +// Loop through our array, show HTML source as HTML source; and line numbers too. +foreach ($lines as $line_num => $line) { echo "Line #{$line_num} : " . htmlspecialchars($line) . "
\n"; } -// Un'altro esempio, inserisce la pagina web in una stringa. Vedere anche file_get_contents(). -$html = implode('', file ('http://www.example.com/')); +// Using the optional flags parameter +$trimmed = file('somefile.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); ?> ]]> -
-
-
-&tip.fopen-wrapper; - - - Ciascuna riga dell'array restituito conterrà il carattere di fine riga, occorre, pertanto, - utilizzare rtrim se si desidera rimuovere il carattere - di fine riga. - - - ¬e.line-endings; - - - 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. - - - ¬e.context-support; - &warn.ssl-non-standard; - - Vedere anche readfile, - fopen, fsockopen, - popen, file_get_contents e - include. - -
-
+ + + + + + + &reftitle.notes; + &warn.ssl-non-standard; + + + + &reftitle.seealso; + + + file_get_contents + readfile + fopen + fsockopen + popen + include + stream_context_create + + + + + + @@ -161,16 +161,16 @@ $line) { echo "Line #{$line_num} : " . htmlspecialchars($line) . "
\n"; } -// Using the optional flags parameter +//Utilizzando i flag come parametro opzionale $trimmed = file('somefile.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); ?> ]]> From 6eeb343f67cf9d690c9588dae8f5fe98f26d8bd9 Mon Sep 17 00:00:00 2001 From: Manuel della Gala <74384683+ManueldG@users.noreply.github.com> Date: Wed, 19 Feb 2025 15:25:17 +0100 Subject: [PATCH 5/7] corrections from Davide Pastore --- reference/filesystem/functions/file.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/reference/filesystem/functions/file.xml b/reference/filesystem/functions/file.xml index b6f859d87..1d0ea73f9 100644 --- a/reference/filesystem/functions/file.xml +++ b/reference/filesystem/functions/file.xml @@ -1,6 +1,6 @@ - - + + file @@ -21,7 +21,7 @@ In alternativa puoi usare file_get_contents per estrarre il contenuto - di un file sottoforma di stringa. + di un file sotto forma di stringa. @@ -157,20 +157,20 @@ &reftitle.examples; - <function>file</function> esempio + Esempio di <function>file</function> $line) { echo "Line #{$line_num} : " . htmlspecialchars($line) . "
\n"; } -//Utilizzando i flag come parametro opzionale +//Utilizzo del parametro flag opzionale $trimmed = file('somefile.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); ?> ]]> From 88e4a52e696f450c703db38c60bfcfdc342ba128 Mon Sep 17 00:00:00 2001 From: Manuel della Gala <74384683+ManueldG@users.noreply.github.com> Date: Wed, 26 Feb 2025 15:25:43 +0100 Subject: [PATCH 6/7] Update file.xml --- reference/filesystem/functions/file.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/filesystem/functions/file.xml b/reference/filesystem/functions/file.xml index 1d0ea73f9..894d4b6fa 100644 --- a/reference/filesystem/functions/file.xml +++ b/reference/filesystem/functions/file.xml @@ -161,7 +161,7 @@ Date: Thu, 27 Feb 2025 14:51:02 +0100 Subject: [PATCH 7/7] minor corrections file.xml --- reference/filesystem/functions/file.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/filesystem/functions/file.xml b/reference/filesystem/functions/file.xml index 894d4b6fa..663c25488 100644 --- a/reference/filesystem/functions/file.xml +++ b/reference/filesystem/functions/file.xml @@ -1,5 +1,6 @@ +