cvs: phpdoc-it /reference/filesystem/functions basename.xml chgrp.xml dirname.xml disk-total-space.xml feof.xml fgetcsv.xml file-exists.xml
file-get-contents.xml file.xml fileatime.xml filectime.xml filegroup.xml filetype.xml flock.xml fopen.xml fpassthru.xml fputs.xml ftruncate.xml
| From: | Andrioli Darvin | Date: | Fri, 23 Jan 2004 20:22:39 +0000 |
| Subject: | cvs: phpdoc-it /reference/filesystem/functions basename.xml chgrp.xml dirname.xml disk-total-space.xml feof.xml fgetcsv.xml file-exists.xml file-get-contents.xml file.xml fileatime.xml filectime.xml filegroup.xml filetype.xml flock.xml fopen.xml fpassthru.xml fputs.xml ftruncate.xml |
||
| Groups: | php.doc.it | ||
| Request: | Send a blank email to doc-it+get-520@lists.php.net to get a copy of this message | ||
darvina Fri Jan 23 15:22:39 2004 EDT
Modified files:
/phpdoc-it/reference/filesystem/functions basename.xml chgrp.xml
dirname.xml
disk-total-space.xml
feof.xml fgetcsv.xml
file-exists.xml
file-get-contents.xml
file.xml fileatime.xml
filectime.xml
filegroup.xml
filetype.xml flock.xml
fopen.xml fpassthru.xml
fputs.xml ftruncate.xml
Log:
Sync to En tree
http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/basename.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/basename.xml diff -u phpdoc-it/reference/filesystem/functions/basename.xml:1.3 phpdoc-it/reference/filesystem/functions/basename.xml:1.4 --- phpdoc-it/reference/filesystem/functions/basename.xml:1.3 Fri Oct 10 15:48:59 2003 +++ phpdoc-it/reference/filesystem/functions/basename.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'basename' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.3 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.4 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.basename"> <refnamediv> @@ -34,8 +34,8 @@ <![CDATA[ <?php $path = "/home/httpd/html/index.php"; -$file = basename ($path); // la variabile $file contiene "index.php" -$file = basename ($path,".php"); // la variabile $file contiene "index" +$file = basename($path); // la variabile $file contiene "index.php" +$file = basename($path,".php"); // la variabile $file contiene "index" ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/chgrp.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/chgrp.xml diff -u phpdoc-it/reference/filesystem/functions/chgrp.xml:1.3 phpdoc-it/reference/filesystem/functions/chgrp.xml:1.4 --- phpdoc-it/reference/filesystem/functions/chgrp.xml:1.3 Fri Oct 10 15:48:59 2003 +++ phpdoc-it/reference/filesystem/functions/chgrp.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'chgrp' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.4 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.6 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.chgrp"> <refnamediv> @@ -24,6 +24,8 @@ <para> Restituisce &true; se ha successo; &false; altrimenti. </para> + ¬e.no-remote; + ¬e.sm.uidcheck; <para> Vedere anche <function>chown</function> e <function>chmod</function>. http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/dirname.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/dirname.xml diff -u phpdoc-it/reference/filesystem/functions/dirname.xml:1.3 phpdoc-it/reference/filesystem/functions/dirname.xml:1.4 --- phpdoc-it/reference/filesystem/functions/dirname.xml:1.3 Fri Oct 10 15:48:59 2003 +++ phpdoc-it/reference/filesystem/functions/dirname.xml Fri Jan 23 15:22:39 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> -<!-- EN-Revision: 1.5 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.6 Maintainer: cortesi Status: working --> <refentry id="function.dirname"> <refnamediv> <refname>dirname</refname> @@ -28,7 +28,7 @@ <![CDATA[ <?php $path = "/etc/passwd"; -$file = dirname ($path); // $file contiene "/etc" +$file = dirname($path); // $file contiene "/etc" ?> ]]> </programlisting> @@ -38,7 +38,7 @@ <para> In PHP 4.0.3, la funzione <function>dirname</function> è stata modificata per essere conforme alle specifiche POSIX. Essenzialmente ciò significa che non ci sono slash - nel parametro <parameter>path</parameter> , viene restuito un punto + nel parametro <parameter>path</parameter> , viene restituito un punto ('<literal>.</literal>') per indicare la directory corrente. In altro modo, la stringa restituita è <parameter>path</parameter> senza alcun http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/disk-total-space.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/disk-total-space.xml diff -u phpdoc-it/reference/filesystem/functions/disk-total-space.xml:1.3 phpdoc-it/reference/filesystem/functions/disk-total-space.xml:1.4 --- phpdoc-it/reference/filesystem/functions/disk-total-space.xml:1.3 Fri Oct 10 15:48:59 2003 +++ phpdoc-it/reference/filesystem/functions/disk-total-space.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.3 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.4 Maintainer: cortesi Status: working --> <refentry id="function.disk-total-space"> <refnamediv> <refname>disk_total_space</refname> @@ -23,6 +23,10 @@ <![CDATA[ // $df contiene il numero totale di byte disponibile su "/" $df = disk_total_space("/"); + +// Su Windows: +disk_total_space("C:"); +disk_total_space("D:"); ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/feof.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/feof.xml diff -u phpdoc-it/reference/filesystem/functions/feof.xml:1.3 phpdoc-it/reference/filesystem/functions/feof.xml:1.4 --- phpdoc-it/reference/filesystem/functions/feof.xml:1.3 Fri Oct 17 15:53:34 2003 +++ phpdoc-it/reference/filesystem/functions/feof.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.4 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.7 Maintainer: cortesi Status: working --> <refentry id="function.feof"> <refnamediv> <refname>feof</refname> @@ -13,8 +13,17 @@ </methodsynopsis> <para> Restituisce &true; se il puntatore al file ha raggiunto la fine del file (EOF) - o si è verificato un errore; altrimenti restituisce &false;. + o si è verificato un errore (anche in caso timeoute del socket); altrimenti restituisce &false;. </para> + <warning> + <simpara> + La funzione <function>feof</function> restituirà &true; soltanto se la connessione aperta da + <function>fsockopen</function> è chiusa. Ciò può portare in timeout lo + lo script. Un trucco per evitare ciò consiste nell'utilizzare la funzione + <function>stream_set_timeout</function>, in modo da costringere + <function>feof</function> a restituire &false; in caso di timeout. + </simpara> + </warning> <para> Il puntatore al file deve essere valido e deve puntare ad un file correttamente aperto da <function>fopen</function>, http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/fgetcsv.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-it/reference/filesystem/functions/fgetcsv.xml diff -u phpdoc-it/reference/filesystem/functions/fgetcsv.xml:1.4 phpdoc-it/reference/filesystem/functions/fgetcsv.xml:1.5 --- phpdoc-it/reference/filesystem/functions/fgetcsv.xml:1.4 Fri Oct 17 15:53:34 2003 +++ phpdoc-it/reference/filesystem/functions/fgetcsv.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.8 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.9 Maintainer: cortesi Status: working --> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <refentry id="function.fgetcsv"> <refnamediv> @@ -18,7 +18,7 @@ <simpara> Simile a <function>fgets</function> eccetto per il fatto che <function>fgetcsv</function> analizza le righe lette alla ricerca di campi - in in formato <acronym>CSV</acronym> e restituisce un vettore contenente + in formato <acronym>CSV</acronym> e restituisce un vettore contenente i campi letti. Il delimitatore di campo è una virgola, a meno che non venga specificato un altro delimitatore usando il terzo parametro opzionale, mentre per il quarto parametro opzionale, <parameter>enclosure</parameter>, @@ -59,16 +59,16 @@ <![CDATA[ <?php $row = 1; -$handle = fopen ("test.csv","r"); -while ($data = fgetcsv ($handle, 1000, ",")) { - $num = count ($data); - print "<p> $num campi sulla linea $row: <br>\n"; +$handle = fopen("test.csv","r"); +while ($data = fgetcsv($handle, 1000, ",")) { + $num = count($data); + echo "<p> $num campi sulla linea $row: <br >\n"; $row++; for ($c=0; $c < $num; $c++) { - print $data[$c] . "<br>\n"; + echo $data[$c] . "<br>\n"; } } -fclose ($handle); +fclose($handle); ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/file-exists.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/file-exists.xml diff -u phpdoc-it/reference/filesystem/functions/file-exists.xml:1.2 phpdoc-it/reference/filesystem/functions/file-exists.xml:1.3 --- phpdoc-it/reference/filesystem/functions/file-exists.xml:1.2 Wed Apr 17 03:06:36 2002 +++ phpdoc-it/reference/filesystem/functions/file-exists.xml Fri Jan 23 15:22:39 2004 @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'file-exists' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.12 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.file-exists"> <refnamediv> <refname>file_exists</refname> - <refpurpose>Controlla se un file esiste</refpurpose> + <refpurpose>Controlla se un file o directory esiste</refpurpose> </refnamediv> <refsect1> <title>Descrizione</title> @@ -15,18 +15,40 @@ <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <simpara> - Restituisce &true; se il file specificato da + Restituisce &true; se il file o la directory specificata da <parameter>filename</parameter> esiste; &false; altrimenti. </simpara> - <simpara> - Questa funzione non lavora con i <link - linkend="features.remote-files">file remoti</link>; il file da esaminare - deve essere accessibile attraverso il filesystem del server. - </simpara> - <simpara> - I risultati di questa funzione vengono memorizzati nella cache. Vedi - <function>clearstatcache</function> per maggiori informazioni. - </simpara> + <para> + Sui sistemi Windows utlizzare <filename>//computername/share/filename</filename> oppure + <filename>\\computername\share\filename</filename> per verificare file su dischi condivisi. + </para> + <para> + <example> + <title>Verificare l'esistenza di un file</title> + <programlisting role="php"> +<![CDATA[ +<?php +$filename = '/path/to/foo.txt'; + +if (file_exists($filename)) { + echo "il file $filename esiste"; +} else { + echo "Il file $filename non esiste"; +} +?> +]]> + </programlisting> + </example> + </para> + + ¬e.clearstatcache; + + &tip.fopen-wrapper.stat; + + <para> + Vedere anche <function>is_readable</function>, <function>is_writable</function>, + <function>is_file</function> e <function>file</function>. + </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/file-get-contents.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/file-get-contents.xml diff -u phpdoc-it/reference/filesystem/functions/file-get-contents.xml:1.2 phpdoc-it/reference/filesystem/functions/file-get-contents.xml:1.3 --- phpdoc-it/reference/filesystem/functions/file-get-contents.xml:1.2 Wed Apr 17 03:06:37 2002 +++ phpdoc-it/reference/filesystem/functions/file-get-contents.xml Fri Jan 23 15:22:39 2004 @@ -1,26 +1,43 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'file-get-contents' in en/ tree in rev 1.130 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.11 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.130 --> <refentry id="function.file-get-contents"> <refnamediv> <refname>file_get_contents</refname> - <refpurpose>Reads entire file into a string</refpurpose> + <refpurpose>Legge un file all'interno di una stringa</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>file_get_contents</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>use_include_path</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>use_include_path</parameter></methodparam> + <methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam> </methodsynopsis> <para> - Identical to <function>readfile</function>, except that - <function>file_get_contents</function> returns the file in a string. + Simile alla funzione <function>file</function>, tranne che + <function>file_get_contents</function> restituisce il file in una stringa. </para> + <para> + La funzione <function>file_get_contents</function> è la via preferenziale + per leggere il contenuto di un file in una stringa. La funzione + utilizza tecniche di mappatura della memoria, se sono supportate dal sistema operativo, + per ottimizzare le prestazioni. + </para> ¬e.bin-safe; &tip.fopen-wrapper; + <note> + <simpara> + Il supporto per il contesto è stato aggiunto in <literal>PHP 5.0.0</literal>. + </simpara> + </note> + <simpara> + Vedere anche: <function>fgets</function>, <function>file</function>, + <function>fread</function>, <function>include</function> + e <function>readfile</function>. + </simpara> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/file.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/file.xml diff -u phpdoc-it/reference/filesystem/functions/file.xml:1.3 phpdoc-it/reference/filesystem/functions/file.xml:1.4 --- phpdoc-it/reference/filesystem/functions/file.xml:1.3 Fri Oct 17 15:53:34 2003 +++ phpdoc-it/reference/filesystem/functions/file.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.10 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.14 Maintainer: cortesi Status: working --> <refentry id="function.file"> <refnamediv> <refname>file</refname> @@ -30,16 +30,16 @@ <programlisting role="php"> <![CDATA[ <?php -// inserisce una pagina web in un array e la stampa. In questo eesempio useremo il protocollo -// HTTP per otterenere il sorgente di un URL -$lines = file ('http://www.example.com/'); -// Ciclo atrraverso l'array, si visualizzerà il sorgente come html ed i numeri di linea -foreach ($lines as $line_num => $line) { - echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br>\n"; +// inserisce una pagina web in un array e la stampa. In questo esempio useremo il protocollo +// HTTP per ottenere il sorgente di un URL +$lines = file('http://www.example.com/'); +// Ciclo attraverso l'array, si visualizzerà il sorgente come html ed i numeri di linea +foreach($lines as $line_num => $line) { + echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n"; } // Un'altro esempio, inserisce la pagina web in una stringa. Vedere anche file_get_contents(). -$html = implode ('', file ('http://www.example.com/')); +$html = implode('', file ('http://www.example.com/')); ?> ]]> </programlisting> @@ -49,7 +49,7 @@ <note> <para> Ciascuna riga dell'array restituito conterrà il carattere di fine riga, occorre, pertanto, - utilizzare <function>trim</function> se si desidera rimuovere il carattere + utilizzare <function>rtrim</function> se si desidera rimuovere il carattere di fine riga. </para> </note> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/fileatime.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/fileatime.xml diff -u phpdoc-it/reference/filesystem/functions/fileatime.xml:1.3 phpdoc-it/reference/filesystem/functions/fileatime.xml:1.4 --- phpdoc-it/reference/filesystem/functions/fileatime.xml:1.3 Fri Oct 17 15:53:34 2003 +++ phpdoc-it/reference/filesystem/functions/fileatime.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.4 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.6 Maintainer: cortesi Status: working --> <refentry id="function.fileatime"> <refnamediv> <refname>fileatime</refname> @@ -22,13 +22,11 @@ ad un numero elevato di file o directory. Alcuni filesystem Unix possono essere montati con l'aggiornamento dell'atime disabilitato per aumentare le performance di tali applicazioni; Gli spool delle news USENET - costituiscono un esempo frequente. In tali filesystem + costituiscono un esempio frequente. In tali filesystem queste funzioni sono inutili. </simpara> ¬e.clearstatcache; - - ¬e.no-remote; - + &tip.fopen-wrapper.stat; <para> <example> <title>Esempio per <function>fileatime</function></title> @@ -40,7 +38,7 @@ $filename = 'somefile.txt'; if (file_exists($filename)) { - echo "$filename è stato aperto il: " . date ("F d Y H:i:s.", fileatime($filename)); + echo "$filename è stato aperto il: " . date("F d Y H:i:s.", fileatime($filename)); } ?> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/filectime.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/filectime.xml diff -u phpdoc-it/reference/filesystem/functions/filectime.xml:1.2 phpdoc-it/reference/filesystem/functions/filectime.xml:1.3 --- phpdoc-it/reference/filesystem/functions/filectime.xml:1.2 Wed Apr 17 03:06:37 2002 +++ phpdoc-it/reference/filesystem/functions/filectime.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'filectime' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.6 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.filectime"> <refnamediv> @@ -19,10 +19,6 @@ caso d'errore. L'ora viene restituita come un timestamp di Unix. </para> <para> - I risultati di questa funzione vengono memorizzati nella cache. Vedi - <function>clearstatcache</function> per maggiori informazioni. - </para> - <para> Nota: In molti filesystem Unix, si considera un file modificato, quando il suo inode viene cambiato; cioè quando i permessi, il proprietario, il gruppo o altri metadata dell'inode vengono aggiornati. Vedere anche @@ -35,10 +31,30 @@ un file come l'ora di creazione dello stesso. E' sbagliato. Nella maggioranza dei filesystem Unix non esiste un oa di creazione. </para> + ¬e.clearstatcache; + &tip.fopen-wrapper.stat; + + <para> + <example> + <title>Esempio di uso di <function>fileatime</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + +// Visualizza ad esempio: somefile.txt è stato modificato: December 29 2002 22:16:23. + +$filename = 'somefile.txt'; +if (file_exists($filename)) { + echo "$filename è stato modificato: " . date("F d Y H:i:s.", filectime($filename)); +} + +?> +]]> + </programlisting> + </example> + </para> <simpara> - Questa funzione non lavora con i <link - linkend="features.remote-files">file remoti</link>; i file da - esaminare devono essere accessibili attraverso il filesystem del server. + Vedere anche <function>filemtime</function>. </simpara> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/filegroup.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/filegroup.xml diff -u phpdoc-it/reference/filesystem/functions/filegroup.xml:1.2 phpdoc-it/reference/filesystem/functions/filegroup.xml:1.3 --- phpdoc-it/reference/filesystem/functions/filegroup.xml:1.2 Wed Apr 17 03:06:37 2002 +++ phpdoc-it/reference/filesystem/functions/filegroup.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'filegroup' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.6 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.filegroup"> <refnamediv> @@ -15,22 +15,18 @@ <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> - Restituisce il l'ID del gruppo cui appartiene il proprietario del file, + Restituisce il l'ID del gruppo del file, o &false; in caso d'errore. L'ID del gruppo viene restituito in formato numerico: usa <function>posix_getgrgid</function> per trasformarlo nel nome del gruppo. + In caso di errore la funzione restituisce &false; accompagnato da un errore di + di livello <constant>E_WARNING</constant>. </para> - <para> - I risultati di questa funzione vengono memorizzati nella cache. Vedi - <function>clearstatcache</function> per maggiori informazioni. - </para> - ¬e.no-windows; - <note> - <simpara> - Questa funzione non lavora con i <link - linkend="features.remote-files">file remoti</link>; i file da - esaminare devono essere accessibili attraverso il filesystem del server. + ¬e.clearstatcache; + &tip.fopen-wrapper.stat; + <simpara> + Vedere anche: <function>fileowner</function> e + <link linkend="ini.safe-mode-gid">safe_mode_gid</link>. </simpara> - </note> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/filetype.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/filetype.xml diff -u phpdoc-it/reference/filesystem/functions/filetype.xml:1.3 phpdoc-it/reference/filesystem/functions/filetype.xml:1.4 --- phpdoc-it/reference/filesystem/functions/filetype.xml:1.3 Tue Apr 23 05:40:41 2002 +++ phpdoc-it/reference/filesystem/functions/filetype.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.3 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.10 Maintainer: cortesi Status: working --> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <refentry id="function.filetype"> <refnamediv> @@ -17,21 +17,32 @@ dir, block, link, file e unknown. </para> <para> - Restituisce &false; se si verifica un errore. + Restituisce &false; se si verifica un errore. Inoltre la funzione + <function>filetype</function> genera un errore di livello <constant>E_NOTICE</constant> + se fallisce la chiamata a stat o se il tipo è sconosciuto. </para> + + ¬e.clearstatcache; + + &tip.fopen-wrapper.stat; <para> - I risultati di questa funzione vengono memorizzati nella cache. Vedi - <function>clearstatcache</function> per maggiori informazioni. + <example> + <title>Esempio di uso di <function>filetype</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +echo filetype('/etc/passwd'); // file +echo filetype('/etc/'); // dir + +?> +]]> + </programlisting> + </example> </para> <simpara> - Questa funzione non lavora con i <link - linkend="features.remote-files">file remoti</link>; i file da - esaminare devono essere accessibili attraverso il filesystem del server. - </simpara> - <simpara> Vedere anche: <function>is_dir</function>, <function>is_file</function>, - <function>is_link</function>, <function>file_exists</function> e - <function>stat</function>. + <function>is_link</function>, <function>file_exists</function>, + <function>stat</function> e <function>mime_content_type</function>. </simpara> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/flock.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/flock.xml diff -u phpdoc-it/reference/filesystem/functions/flock.xml:1.2 phpdoc-it/reference/filesystem/functions/flock.xml:1.3 --- phpdoc-it/reference/filesystem/functions/flock.xml:1.2 Wed Apr 17 03:06:38 2002 +++ phpdoc-it/reference/filesystem/functions/flock.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'flock' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.8 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.flock"> <refnamediv> @@ -12,9 +12,9 @@ <title>Descrizione</title> <methodsynopsis> <type>bool</type><methodname>flock</methodname> - <methodparam><type>int</type><parameter>fp</parameter></methodparam> + <methodparam><type>resource</type><parameter>handle</parameter></methodparam> <methodparam><type>int</type><parameter>operation</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>wouldblock</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>&wouldblock</parameter></methodparam> </methodsynopsis> <simpara> Il PHP supporta un tecnologia portabile per bloccare file completi in modalità @@ -22,7 +22,7 @@ bloccaggio o non funzionerà). </simpara> <simpara> - <function>flock</function> opera su <parameter>fp</parameter> + <function>flock</function> opera su <parameter>handle</parameter> che deve essere un puntatore ad un file aperto. <parameter>operation</parameter> può assumere uno dei valori seguenti: @@ -32,28 +32,28 @@ <listitem> <simpara> Per acquisire una chiave condivisa (in lettura), imposta - <parameter>operation</parameter> a LOCK_SH (usa 1 prima di + <parameter>operation</parameter> a <constant>LOCK_SH</constant> (usa 1 prima di PHP 4.0.1). </simpara> </listitem> <listitem> <simpara> Per acquisire una chiave esclusiva (in scrittura), imposta - <parameter>operation</parameter> a LOCK_EX (usa 2 prima di + <parameter>operation</parameter> a <constant>LOCK_EX</constant> (usa 2 prima di PHP 4.0.1). </simpara> </listitem> <listitem> <simpara> Per rilasciare una chiave (condivisa o esclusiva), imposta - <parameter>operation</parameter> a LOCK_UN (usa 3 prima + <parameter>operation</parameter> a <constant>LOCK_UN</constant> (usa 3 prima PHP 4.0.1). </simpara> </listitem> <listitem> <simpara> Se non vuoi che <function>flock</function> blocchi mentre, - imposta come LOCK_NB (4 prima di PHP 4.0.1) + imposta come <constant>LOCK_NB</constant> (4 prima di PHP 4.0.1) <parameter>operation</parameter>. </simpara> </listitem> @@ -67,30 +67,57 @@ errno condition) </simpara> <simpara> - <function>flock</function> restituisce &true; se ha successo e &false; in caso - d'errore (ad esempio quando una chiave (lock) non può venire acquisita). + &return.success; </simpara> + <para> + <example> + <title>Esempio di uso di <function>flock</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + +$fp = fopen("/tmp/lock.txt", "w+"); + +if (flock($fp, LOCK_EX)) { // Esegue un lock esclusivo + fwrite($fp, "Write something here\n"); + flock($fp, LOCK_UN); // rilascia il lock +} else { + echo "Non si riesce ad eseguire il lock del file !"; +} + +fclose($fp); + +?> +]]> + </programlisting> + </example> + </para> <note> <para> - Because <function>flock</function> requires a file pointer, you may have - to use a special lock file to protect access to a file that you intend - to truncate by opening it in write mode (with a "w" or "w+" argument to - <function>fopen</function>). + Poiché <function>flock</function> richiede il puntatore ad un file, può occorre + utilizzare un speciale file di lock per proteggere l'accesso a eventuali file che si desidera + azzerare attraverso l'apertura in modalità di scrittura (usando "w" o "w+" come argomento + di <function>fopen</function>). </para> </note> <warning> <para> - <function>flock</function> will not work on NFS and many other networked - file systems. Check your operating system documentation for more - details. + La funzione <function>flock</function> non funzione con NFS e con diversi altri file system + di rete. Verificare sulla documentazione del proprio sistema operativo. </para> <para> Su molti sistemi operativi <function>flock</function> è implementato a livello di processo. Usando un server API multithread quale - ISAPI non potrai basarti su <function>flock</function> per proteggerre + ISAPI non potrai basarti su <function>flock</function> per proteggere i file da altri script PHP che girino in thread paralleli della stessa istanza del server! </para> + <para> + La funzione <function>flock</function> non è supportata su file system antiquati tipo + <literal>FAT</literal> e i suoi derivati e pertanto in tali ambienti restituirà sempre + &false; (questo è vero soprattutto per gli utenti di + Windows 98). + </para> </warning> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/fopen.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-it/reference/filesystem/functions/fopen.xml diff -u phpdoc-it/reference/filesystem/functions/fopen.xml:1.4 phpdoc-it/reference/filesystem/functions/fopen.xml:1.5 --- phpdoc-it/reference/filesystem/functions/fopen.xml:1.4 Fri Oct 17 15:53:34 2003 +++ phpdoc-it/reference/filesystem/functions/fopen.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.18 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.21 Maintainer: cortesi Status: working --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fopen"> <refnamediv> @@ -221,10 +221,10 @@ <programlisting role="php"> <![CDATA[ <?php -$handle = fopen ("/home/rasmus/file.txt", "r"); -$handle = fopen ("/home/rasmus/file.gif", "wb"); -$handle = fopen ("http://www.example.com/", "r"); -$handle = fopen ("ftp://user:password@example.com/somefile.txt", "w"); +$handle = fopen("/home/rasmus/file.txt", "r"); +$handle = fopen("/home/rasmus/file.gif", "wb"); +$handle = fopen("http://www.example.com/", "r"); +$handle = fopen("ftp://user:password@example.com/somefile.txt", "w"); ?> ]]> </programlisting> @@ -244,12 +244,13 @@ <programlisting role="php"> <![CDATA[ <?php -$handle = fopen ("c:\\data\\info.txt", "r"); +$handle = fopen("c:\\data\\info.txt", "r"); ?> ]]> </programlisting> </informalexample> </para> + ¬e.sm.uidcheck.dir; <simpara> Vedere anche <xref linkend="wrappers"/>, <function>fclose</function>, http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/fpassthru.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/fpassthru.xml diff -u phpdoc-it/reference/filesystem/functions/fpassthru.xml:1.2 phpdoc-it/reference/filesystem/functions/fpassthru.xml:1.3 --- phpdoc-it/reference/filesystem/functions/fpassthru.xml:1.2 Wed Apr 17 03:06:38 2002 +++ phpdoc-it/reference/filesystem/functions/fpassthru.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'fpassthru' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.7 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.fpassthru"> <refnamediv> @@ -12,15 +12,17 @@ <title>Descrizione</title> <methodsynopsis> <type>int</type><methodname>fpassthru</methodname> - <methodparam><type>int</type><parameter>fp</parameter></methodparam> + <methodparam><type>resource</type><parameter>handle</parameter></methodparam> </methodsynopsis> <simpara> - Legge fino a EOF sul puntatore al file dato e scrive i risultati sullo - standard output. + Legge fino a EOF sul puntatore al file dato e scrive i risultati sul buffer di + output. </simpara> <simpara> Se si verifica un errore, <function>fpassthru</function> restituisce - &false;. + &false;. In caso positivo <function>fpassthru</function> restituisce + il numero di caratteri letti da <parameter>handle</parameter> scritti + in output. </simpara> <simpara> Il puntatore al file deve essere valido e deve puntare ad un file @@ -29,21 +31,51 @@ <function>rewind</function> to reset the file pointer to the beginning of the file if you have already written data to the file. Il file viene chiuso quando <function>fpassthru</function> viene conclusa - la sua lettura (lasciando <parameter>fp</parameter> inutilizzato). + la sua lettura (lasciando <parameter>handle</parameter> inutilizzato). </simpara> <simpara> - Se desideri semplicemente inviare il contenuto di un file sullo stdout, + Se desideri semplicemente inviare il contenuto di un file sul buffer di output, + senza doverlo modificare o posizionarti in un particolare offset, potresti preferire <function>readfile</function>, che ti salva la chiamata a <function>fopen</function>. </simpara> <note> <para> - When using <function>fpassthru</function> on a binary file on Windows - systems, you should make sure to open the file in binary mode by - appending a <literal>b</literal> to the mode used in the call to + Quando si utilizza <function>fpassthru</function> con file binari su sistemi Windows + si dovrebbe essere certi di aprire il file in modalità binaria + aggiungendo <literal>b</literal> alla modalità utilizzata nella chiamata a <function>fopen</function>. </para> + <para> + Si incoraggia l'uso del flag <literal>b</literal> quando si trattano file binari, + anche se il sistema non lo richiede; in questo modo si rendono gli script + più trasportabili. + </para> </note> + <para> + <example> + <title>Utilizzo di <function>fpassthru</function> con file binari</title> + <programlisting role="php"> +<![CDATA[ +<?php + +// apre il file in modalità binaria +$name = ".\public\dev\img\ok.png"; +$fp = fopen($name, 'rb'); + +// invia i giusti header +header("Content-Type: image/png"); +header("Content-Length: " . filesize($name)); + +// invia l'immagine ed esce dallo script +fpassthru($fp); +exit; + +?> +]]> + </programlisting> + </example> + </para> <simpara> Vedere anche <function>readfile</function>, <function>fopen</function>, <function>popen</function> e http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/fputs.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/fputs.xml diff -u phpdoc-it/reference/filesystem/functions/fputs.xml:1.2 phpdoc-it/reference/filesystem/functions/fputs.xml:1.3 --- phpdoc-it/reference/filesystem/functions/fputs.xml:1.2 Wed Apr 17 03:06:38 2002 +++ phpdoc-it/reference/filesystem/functions/fputs.xml Fri Jan 23 15:22:39 2004 @@ -1,26 +1,17 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'fputs' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.5 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.fputs"> <refnamediv> <refname>fputs</refname> - <refpurpose>Scrive su un puntatore a file</refpurpose> + <refpurpose>Alias di <function>fwrite</function></refpurpose> </refnamediv> <refsect1> <title>Descrizione</title> - <methodsynopsis> - <type>int</type><methodname>fputs</methodname> - <methodparam><type>int</type><parameter>fp</parameter></methodparam> - <methodparam><type>string</type><parameter>str</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam> - </methodsynopsis> <para> - <function>fputs</function> è un alias di - <function>fwrite</function> del tutto identico. Nota che il parametro - <parameter>length</parameter> è opzionale e se non specificato verrà scritta - l'intera stringa. + <function>fputs</function> è un alias di <function>fwrite</function>. </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/ftruncate.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/ftruncate.xml diff -u phpdoc-it/reference/filesystem/functions/ftruncate.xml:1.2 phpdoc-it/reference/filesystem/functions/ftruncate.xml:1.3 --- phpdoc-it/reference/filesystem/functions/ftruncate.xml:1.2 Wed Apr 17 03:06:39 2002 +++ phpdoc-it/reference/filesystem/functions/ftruncate.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'ftruncate' in en/ tree in rev 1.14 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.6 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.14 --> <refentry id="function.ftruncate"> <refnamediv> @@ -11,14 +11,25 @@ <refsect1> <title>Descrizione</title> <methodsynopsis> - <type>int</type><methodname>ftruncate</methodname> - <methodparam><type>int</type><parameter>fp</parameter></methodparam> + <type>bool</type><methodname>ftruncate</methodname> + <methodparam><type>resource</type><parameter>handle</parameter></methodparam> <methodparam><type>int</type><parameter>size</parameter></methodparam> </methodsynopsis> <para> - Prende il puntatore al file <parameter>fp</parameter> e tronca il file - alla lunghezza indicata da <parameter>size</parameter>. Questa funzione - restituisce &true; in caso di successo e &false; altrimenti. + Prende il puntatore al file <parameter>handle</parameter> e tronca il file + alla lunghezza indicata da <parameter>size</parameter>. + &return.success; + </para> + <note> + <para> + Nelle versioni di PHP precedenti alla 4.3.3, la funzione <function>ftruncate</function> + restituisce un <type>integer</type> di valore 1 se l'operazione riesce, anziché + restituire <type>boolean</type> &true;. + </para> + </note> + <para> + See also <function>fopen</function> and + <function>fseek</function>. </para> </refsect1> </refentry>
http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/basename.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/basename.xml diff -u phpdoc-it/reference/filesystem/functions/basename.xml:1.3 phpdoc-it/reference/filesystem/functions/basename.xml:1.4 --- phpdoc-it/reference/filesystem/functions/basename.xml:1.3 Fri Oct 10 15:48:59 2003 +++ phpdoc-it/reference/filesystem/functions/basename.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'basename' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.3 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.4 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.basename"> <refnamediv> @@ -34,8 +34,8 @@ <![CDATA[ <?php $path = "/home/httpd/html/index.php"; -$file = basename ($path); // la variabile $file contiene "index.php" -$file = basename ($path,".php"); // la variabile $file contiene "index" +$file = basename($path); // la variabile $file contiene "index.php" +$file = basename($path,".php"); // la variabile $file contiene "index" ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/chgrp.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/chgrp.xml diff -u phpdoc-it/reference/filesystem/functions/chgrp.xml:1.3 phpdoc-it/reference/filesystem/functions/chgrp.xml:1.4 --- phpdoc-it/reference/filesystem/functions/chgrp.xml:1.3 Fri Oct 10 15:48:59 2003 +++ phpdoc-it/reference/filesystem/functions/chgrp.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'chgrp' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.4 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.6 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.chgrp"> <refnamediv> @@ -24,6 +24,8 @@ <para> Restituisce &true; se ha successo; &false; altrimenti. </para> + ¬e.no-remote; + ¬e.sm.uidcheck; <para> Vedere anche <function>chown</function> e <function>chmod</function>. http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/dirname.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/dirname.xml diff -u phpdoc-it/reference/filesystem/functions/dirname.xml:1.3 phpdoc-it/reference/filesystem/functions/dirname.xml:1.4 --- phpdoc-it/reference/filesystem/functions/dirname.xml:1.3 Fri Oct 10 15:48:59 2003 +++ phpdoc-it/reference/filesystem/functions/dirname.xml Fri Jan 23 15:22:39 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> -<!-- EN-Revision: 1.5 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.6 Maintainer: cortesi Status: working --> <refentry id="function.dirname"> <refnamediv> <refname>dirname</refname> @@ -28,7 +28,7 @@ <![CDATA[ <?php $path = "/etc/passwd"; -$file = dirname ($path); // $file contiene "/etc" +$file = dirname($path); // $file contiene "/etc" ?> ]]> </programlisting> @@ -38,7 +38,7 @@ <para> In PHP 4.0.3, la funzione <function>dirname</function> è stata modificata per essere conforme alle specifiche POSIX. Essenzialmente ciò significa che non ci sono slash - nel parametro <parameter>path</parameter> , viene restuito un punto + nel parametro <parameter>path</parameter> , viene restituito un punto ('<literal>.</literal>') per indicare la directory corrente. In altro modo, la stringa restituita è <parameter>path</parameter> senza alcun http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/disk-total-space.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/disk-total-space.xml diff -u phpdoc-it/reference/filesystem/functions/disk-total-space.xml:1.3 phpdoc-it/reference/filesystem/functions/disk-total-space.xml:1.4 --- phpdoc-it/reference/filesystem/functions/disk-total-space.xml:1.3 Fri Oct 10 15:48:59 2003 +++ phpdoc-it/reference/filesystem/functions/disk-total-space.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.3 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.4 Maintainer: cortesi Status: working --> <refentry id="function.disk-total-space"> <refnamediv> <refname>disk_total_space</refname> @@ -23,6 +23,10 @@ <![CDATA[ // $df contiene il numero totale di byte disponibile su "/" $df = disk_total_space("/"); + +// Su Windows: +disk_total_space("C:"); +disk_total_space("D:"); ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/feof.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/feof.xml diff -u phpdoc-it/reference/filesystem/functions/feof.xml:1.3 phpdoc-it/reference/filesystem/functions/feof.xml:1.4 --- phpdoc-it/reference/filesystem/functions/feof.xml:1.3 Fri Oct 17 15:53:34 2003 +++ phpdoc-it/reference/filesystem/functions/feof.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.4 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.7 Maintainer: cortesi Status: working --> <refentry id="function.feof"> <refnamediv> <refname>feof</refname> @@ -13,8 +13,17 @@ </methodsynopsis> <para> Restituisce &true; se il puntatore al file ha raggiunto la fine del file (EOF) - o si è verificato un errore; altrimenti restituisce &false;. + o si è verificato un errore (anche in caso timeoute del socket); altrimenti restituisce &false;. </para> + <warning> + <simpara> + La funzione <function>feof</function> restituirà &true; soltanto se la connessione aperta da + <function>fsockopen</function> è chiusa. Ciò può portare in timeout lo + lo script. Un trucco per evitare ciò consiste nell'utilizzare la funzione + <function>stream_set_timeout</function>, in modo da costringere + <function>feof</function> a restituire &false; in caso di timeout. + </simpara> + </warning> <para> Il puntatore al file deve essere valido e deve puntare ad un file correttamente aperto da <function>fopen</function>, http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/fgetcsv.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-it/reference/filesystem/functions/fgetcsv.xml diff -u phpdoc-it/reference/filesystem/functions/fgetcsv.xml:1.4 phpdoc-it/reference/filesystem/functions/fgetcsv.xml:1.5 --- phpdoc-it/reference/filesystem/functions/fgetcsv.xml:1.4 Fri Oct 17 15:53:34 2003 +++ phpdoc-it/reference/filesystem/functions/fgetcsv.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.8 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.9 Maintainer: cortesi Status: working --> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <refentry id="function.fgetcsv"> <refnamediv> @@ -18,7 +18,7 @@ <simpara> Simile a <function>fgets</function> eccetto per il fatto che <function>fgetcsv</function> analizza le righe lette alla ricerca di campi - in in formato <acronym>CSV</acronym> e restituisce un vettore contenente + in formato <acronym>CSV</acronym> e restituisce un vettore contenente i campi letti. Il delimitatore di campo è una virgola, a meno che non venga specificato un altro delimitatore usando il terzo parametro opzionale, mentre per il quarto parametro opzionale, <parameter>enclosure</parameter>, @@ -59,16 +59,16 @@ <![CDATA[ <?php $row = 1; -$handle = fopen ("test.csv","r"); -while ($data = fgetcsv ($handle, 1000, ",")) { - $num = count ($data); - print "<p> $num campi sulla linea $row: <br>\n"; +$handle = fopen("test.csv","r"); +while ($data = fgetcsv($handle, 1000, ",")) { + $num = count($data); + echo "<p> $num campi sulla linea $row: <br >\n"; $row++; for ($c=0; $c < $num; $c++) { - print $data[$c] . "<br>\n"; + echo $data[$c] . "<br>\n"; } } -fclose ($handle); +fclose($handle); ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/file-exists.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/file-exists.xml diff -u phpdoc-it/reference/filesystem/functions/file-exists.xml:1.2 phpdoc-it/reference/filesystem/functions/file-exists.xml:1.3 --- phpdoc-it/reference/filesystem/functions/file-exists.xml:1.2 Wed Apr 17 03:06:36 2002 +++ phpdoc-it/reference/filesystem/functions/file-exists.xml Fri Jan 23 15:22:39 2004 @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'file-exists' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.12 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.file-exists"> <refnamediv> <refname>file_exists</refname> - <refpurpose>Controlla se un file esiste</refpurpose> + <refpurpose>Controlla se un file o directory esiste</refpurpose> </refnamediv> <refsect1> <title>Descrizione</title> @@ -15,18 +15,40 @@ <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <simpara> - Restituisce &true; se il file specificato da + Restituisce &true; se il file o la directory specificata da <parameter>filename</parameter> esiste; &false; altrimenti. </simpara> - <simpara> - Questa funzione non lavora con i <link - linkend="features.remote-files">file remoti</link>; il file da esaminare - deve essere accessibile attraverso il filesystem del server. - </simpara> - <simpara> - I risultati di questa funzione vengono memorizzati nella cache. Vedi - <function>clearstatcache</function> per maggiori informazioni. - </simpara> + <para> + Sui sistemi Windows utlizzare <filename>//computername/share/filename</filename> oppure + <filename>\\computername\share\filename</filename> per verificare file su dischi condivisi. + </para> + <para> + <example> + <title>Verificare l'esistenza di un file</title> + <programlisting role="php"> +<![CDATA[ +<?php +$filename = '/path/to/foo.txt'; + +if (file_exists($filename)) { + echo "il file $filename esiste"; +} else { + echo "Il file $filename non esiste"; +} +?> +]]> + </programlisting> + </example> + </para> + + ¬e.clearstatcache; + + &tip.fopen-wrapper.stat; + + <para> + Vedere anche <function>is_readable</function>, <function>is_writable</function>, + <function>is_file</function> e <function>file</function>. + </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/file-get-contents.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/file-get-contents.xml diff -u phpdoc-it/reference/filesystem/functions/file-get-contents.xml:1.2 phpdoc-it/reference/filesystem/functions/file-get-contents.xml:1.3 --- phpdoc-it/reference/filesystem/functions/file-get-contents.xml:1.2 Wed Apr 17 03:06:37 2002 +++ phpdoc-it/reference/filesystem/functions/file-get-contents.xml Fri Jan 23 15:22:39 2004 @@ -1,26 +1,43 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'file-get-contents' in en/ tree in rev 1.130 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.11 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.130 --> <refentry id="function.file-get-contents"> <refnamediv> <refname>file_get_contents</refname> - <refpurpose>Reads entire file into a string</refpurpose> + <refpurpose>Legge un file all'interno di una stringa</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>file_get_contents</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>use_include_path</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>use_include_path</parameter></methodparam> + <methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam> </methodsynopsis> <para> - Identical to <function>readfile</function>, except that - <function>file_get_contents</function> returns the file in a string. + Simile alla funzione <function>file</function>, tranne che + <function>file_get_contents</function> restituisce il file in una stringa. </para> + <para> + La funzione <function>file_get_contents</function> è la via preferenziale + per leggere il contenuto di un file in una stringa. La funzione + utilizza tecniche di mappatura della memoria, se sono supportate dal sistema operativo, + per ottimizzare le prestazioni. + </para> ¬e.bin-safe; &tip.fopen-wrapper; + <note> + <simpara> + Il supporto per il contesto è stato aggiunto in <literal>PHP 5.0.0</literal>. + </simpara> + </note> + <simpara> + Vedere anche: <function>fgets</function>, <function>file</function>, + <function>fread</function>, <function>include</function> + e <function>readfile</function>. + </simpara> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/file.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/file.xml diff -u phpdoc-it/reference/filesystem/functions/file.xml:1.3 phpdoc-it/reference/filesystem/functions/file.xml:1.4 --- phpdoc-it/reference/filesystem/functions/file.xml:1.3 Fri Oct 17 15:53:34 2003 +++ phpdoc-it/reference/filesystem/functions/file.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.10 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.14 Maintainer: cortesi Status: working --> <refentry id="function.file"> <refnamediv> <refname>file</refname> @@ -30,16 +30,16 @@ <programlisting role="php"> <![CDATA[ <?php -// inserisce una pagina web in un array e la stampa. In questo eesempio useremo il protocollo -// HTTP per otterenere il sorgente di un URL -$lines = file ('http://www.example.com/'); -// Ciclo atrraverso l'array, si visualizzerà il sorgente come html ed i numeri di linea -foreach ($lines as $line_num => $line) { - echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br>\n"; +// inserisce una pagina web in un array e la stampa. In questo esempio useremo il protocollo +// HTTP per ottenere il sorgente di un URL +$lines = file('http://www.example.com/'); +// Ciclo attraverso l'array, si visualizzerà il sorgente come html ed i numeri di linea +foreach($lines as $line_num => $line) { + echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n"; } // Un'altro esempio, inserisce la pagina web in una stringa. Vedere anche file_get_contents(). -$html = implode ('', file ('http://www.example.com/')); +$html = implode('', file ('http://www.example.com/')); ?> ]]> </programlisting> @@ -49,7 +49,7 @@ <note> <para> Ciascuna riga dell'array restituito conterrà il carattere di fine riga, occorre, pertanto, - utilizzare <function>trim</function> se si desidera rimuovere il carattere + utilizzare <function>rtrim</function> se si desidera rimuovere il carattere di fine riga. </para> </note> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/fileatime.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/fileatime.xml diff -u phpdoc-it/reference/filesystem/functions/fileatime.xml:1.3 phpdoc-it/reference/filesystem/functions/fileatime.xml:1.4 --- phpdoc-it/reference/filesystem/functions/fileatime.xml:1.3 Fri Oct 17 15:53:34 2003 +++ phpdoc-it/reference/filesystem/functions/fileatime.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.4 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.6 Maintainer: cortesi Status: working --> <refentry id="function.fileatime"> <refnamediv> <refname>fileatime</refname> @@ -22,13 +22,11 @@ ad un numero elevato di file o directory. Alcuni filesystem Unix possono essere montati con l'aggiornamento dell'atime disabilitato per aumentare le performance di tali applicazioni; Gli spool delle news USENET - costituiscono un esempo frequente. In tali filesystem + costituiscono un esempio frequente. In tali filesystem queste funzioni sono inutili. </simpara> ¬e.clearstatcache; - - ¬e.no-remote; - + &tip.fopen-wrapper.stat; <para> <example> <title>Esempio per <function>fileatime</function></title> @@ -40,7 +38,7 @@ $filename = 'somefile.txt'; if (file_exists($filename)) { - echo "$filename è stato aperto il: " . date ("F d Y H:i:s.", fileatime($filename)); + echo "$filename è stato aperto il: " . date("F d Y H:i:s.", fileatime($filename)); } ?> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/filectime.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/filectime.xml diff -u phpdoc-it/reference/filesystem/functions/filectime.xml:1.2 phpdoc-it/reference/filesystem/functions/filectime.xml:1.3 --- phpdoc-it/reference/filesystem/functions/filectime.xml:1.2 Wed Apr 17 03:06:37 2002 +++ phpdoc-it/reference/filesystem/functions/filectime.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'filectime' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.6 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.filectime"> <refnamediv> @@ -19,10 +19,6 @@ caso d'errore. L'ora viene restituita come un timestamp di Unix. </para> <para> - I risultati di questa funzione vengono memorizzati nella cache. Vedi - <function>clearstatcache</function> per maggiori informazioni. - </para> - <para> Nota: In molti filesystem Unix, si considera un file modificato, quando il suo inode viene cambiato; cioè quando i permessi, il proprietario, il gruppo o altri metadata dell'inode vengono aggiornati. Vedere anche @@ -35,10 +31,30 @@ un file come l'ora di creazione dello stesso. E' sbagliato. Nella maggioranza dei filesystem Unix non esiste un oa di creazione. </para> + ¬e.clearstatcache; + &tip.fopen-wrapper.stat; + + <para> + <example> + <title>Esempio di uso di <function>fileatime</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + +// Visualizza ad esempio: somefile.txt è stato modificato: December 29 2002 22:16:23. + +$filename = 'somefile.txt'; +if (file_exists($filename)) { + echo "$filename è stato modificato: " . date("F d Y H:i:s.", filectime($filename)); +} + +?> +]]> + </programlisting> + </example> + </para> <simpara> - Questa funzione non lavora con i <link - linkend="features.remote-files">file remoti</link>; i file da - esaminare devono essere accessibili attraverso il filesystem del server. + Vedere anche <function>filemtime</function>. </simpara> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/filegroup.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/filegroup.xml diff -u phpdoc-it/reference/filesystem/functions/filegroup.xml:1.2 phpdoc-it/reference/filesystem/functions/filegroup.xml:1.3 --- phpdoc-it/reference/filesystem/functions/filegroup.xml:1.2 Wed Apr 17 03:06:37 2002 +++ phpdoc-it/reference/filesystem/functions/filegroup.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'filegroup' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.6 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.filegroup"> <refnamediv> @@ -15,22 +15,18 @@ <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> - Restituisce il l'ID del gruppo cui appartiene il proprietario del file, + Restituisce il l'ID del gruppo del file, o &false; in caso d'errore. L'ID del gruppo viene restituito in formato numerico: usa <function>posix_getgrgid</function> per trasformarlo nel nome del gruppo. + In caso di errore la funzione restituisce &false; accompagnato da un errore di + di livello <constant>E_WARNING</constant>. </para> - <para> - I risultati di questa funzione vengono memorizzati nella cache. Vedi - <function>clearstatcache</function> per maggiori informazioni. - </para> - ¬e.no-windows; - <note> - <simpara> - Questa funzione non lavora con i <link - linkend="features.remote-files">file remoti</link>; i file da - esaminare devono essere accessibili attraverso il filesystem del server. + ¬e.clearstatcache; + &tip.fopen-wrapper.stat; + <simpara> + Vedere anche: <function>fileowner</function> e + <link linkend="ini.safe-mode-gid">safe_mode_gid</link>. </simpara> - </note> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/filetype.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/filesystem/functions/filetype.xml diff -u phpdoc-it/reference/filesystem/functions/filetype.xml:1.3 phpdoc-it/reference/filesystem/functions/filetype.xml:1.4 --- phpdoc-it/reference/filesystem/functions/filetype.xml:1.3 Tue Apr 23 05:40:41 2002 +++ phpdoc-it/reference/filesystem/functions/filetype.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.3 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.10 Maintainer: cortesi Status: working --> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <refentry id="function.filetype"> <refnamediv> @@ -17,21 +17,32 @@ dir, block, link, file e unknown. </para> <para> - Restituisce &false; se si verifica un errore. + Restituisce &false; se si verifica un errore. Inoltre la funzione + <function>filetype</function> genera un errore di livello <constant>E_NOTICE</constant> + se fallisce la chiamata a stat o se il tipo è sconosciuto. </para> + + ¬e.clearstatcache; + + &tip.fopen-wrapper.stat; <para> - I risultati di questa funzione vengono memorizzati nella cache. Vedi - <function>clearstatcache</function> per maggiori informazioni. + <example> + <title>Esempio di uso di <function>filetype</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +echo filetype('/etc/passwd'); // file +echo filetype('/etc/'); // dir + +?> +]]> + </programlisting> + </example> </para> <simpara> - Questa funzione non lavora con i <link - linkend="features.remote-files">file remoti</link>; i file da - esaminare devono essere accessibili attraverso il filesystem del server. - </simpara> - <simpara> Vedere anche: <function>is_dir</function>, <function>is_file</function>, - <function>is_link</function>, <function>file_exists</function> e - <function>stat</function>. + <function>is_link</function>, <function>file_exists</function>, + <function>stat</function> e <function>mime_content_type</function>. </simpara> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/flock.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/flock.xml diff -u phpdoc-it/reference/filesystem/functions/flock.xml:1.2 phpdoc-it/reference/filesystem/functions/flock.xml:1.3 --- phpdoc-it/reference/filesystem/functions/flock.xml:1.2 Wed Apr 17 03:06:38 2002 +++ phpdoc-it/reference/filesystem/functions/flock.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'flock' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.8 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.flock"> <refnamediv> @@ -12,9 +12,9 @@ <title>Descrizione</title> <methodsynopsis> <type>bool</type><methodname>flock</methodname> - <methodparam><type>int</type><parameter>fp</parameter></methodparam> + <methodparam><type>resource</type><parameter>handle</parameter></methodparam> <methodparam><type>int</type><parameter>operation</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>wouldblock</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>&wouldblock</parameter></methodparam> </methodsynopsis> <simpara> Il PHP supporta un tecnologia portabile per bloccare file completi in modalità @@ -22,7 +22,7 @@ bloccaggio o non funzionerà). </simpara> <simpara> - <function>flock</function> opera su <parameter>fp</parameter> + <function>flock</function> opera su <parameter>handle</parameter> che deve essere un puntatore ad un file aperto. <parameter>operation</parameter> può assumere uno dei valori seguenti: @@ -32,28 +32,28 @@ <listitem> <simpara> Per acquisire una chiave condivisa (in lettura), imposta - <parameter>operation</parameter> a LOCK_SH (usa 1 prima di + <parameter>operation</parameter> a <constant>LOCK_SH</constant> (usa 1 prima di PHP 4.0.1). </simpara> </listitem> <listitem> <simpara> Per acquisire una chiave esclusiva (in scrittura), imposta - <parameter>operation</parameter> a LOCK_EX (usa 2 prima di + <parameter>operation</parameter> a <constant>LOCK_EX</constant> (usa 2 prima di PHP 4.0.1). </simpara> </listitem> <listitem> <simpara> Per rilasciare una chiave (condivisa o esclusiva), imposta - <parameter>operation</parameter> a LOCK_UN (usa 3 prima + <parameter>operation</parameter> a <constant>LOCK_UN</constant> (usa 3 prima PHP 4.0.1). </simpara> </listitem> <listitem> <simpara> Se non vuoi che <function>flock</function> blocchi mentre, - imposta come LOCK_NB (4 prima di PHP 4.0.1) + imposta come <constant>LOCK_NB</constant> (4 prima di PHP 4.0.1) <parameter>operation</parameter>. </simpara> </listitem> @@ -67,30 +67,57 @@ errno condition) </simpara> <simpara> - <function>flock</function> restituisce &true; se ha successo e &false; in caso - d'errore (ad esempio quando una chiave (lock) non può venire acquisita). + &return.success; </simpara> + <para> + <example> + <title>Esempio di uso di <function>flock</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + +$fp = fopen("/tmp/lock.txt", "w+"); + +if (flock($fp, LOCK_EX)) { // Esegue un lock esclusivo + fwrite($fp, "Write something here\n"); + flock($fp, LOCK_UN); // rilascia il lock +} else { + echo "Non si riesce ad eseguire il lock del file !"; +} + +fclose($fp); + +?> +]]> + </programlisting> + </example> + </para> <note> <para> - Because <function>flock</function> requires a file pointer, you may have - to use a special lock file to protect access to a file that you intend - to truncate by opening it in write mode (with a "w" or "w+" argument to - <function>fopen</function>). + Poiché <function>flock</function> richiede il puntatore ad un file, può occorre + utilizzare un speciale file di lock per proteggere l'accesso a eventuali file che si desidera + azzerare attraverso l'apertura in modalità di scrittura (usando "w" o "w+" come argomento + di <function>fopen</function>). </para> </note> <warning> <para> - <function>flock</function> will not work on NFS and many other networked - file systems. Check your operating system documentation for more - details. + La funzione <function>flock</function> non funzione con NFS e con diversi altri file system + di rete. Verificare sulla documentazione del proprio sistema operativo. </para> <para> Su molti sistemi operativi <function>flock</function> è implementato a livello di processo. Usando un server API multithread quale - ISAPI non potrai basarti su <function>flock</function> per proteggerre + ISAPI non potrai basarti su <function>flock</function> per proteggere i file da altri script PHP che girino in thread paralleli della stessa istanza del server! </para> + <para> + La funzione <function>flock</function> non è supportata su file system antiquati tipo + <literal>FAT</literal> e i suoi derivati e pertanto in tali ambienti restituirà sempre + &false; (questo è vero soprattutto per gli utenti di + Windows 98). + </para> </warning> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/fopen.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-it/reference/filesystem/functions/fopen.xml diff -u phpdoc-it/reference/filesystem/functions/fopen.xml:1.4 phpdoc-it/reference/filesystem/functions/fopen.xml:1.5 --- phpdoc-it/reference/filesystem/functions/fopen.xml:1.4 Fri Oct 17 15:53:34 2003 +++ phpdoc-it/reference/filesystem/functions/fopen.xml Fri Jan 23 15:22:39 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.18 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.21 Maintainer: cortesi Status: working --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fopen"> <refnamediv> @@ -221,10 +221,10 @@ <programlisting role="php"> <![CDATA[ <?php -$handle = fopen ("/home/rasmus/file.txt", "r"); -$handle = fopen ("/home/rasmus/file.gif", "wb"); -$handle = fopen ("http://www.example.com/", "r"); -$handle = fopen ("ftp://user:password@example.com/somefile.txt", "w"); +$handle = fopen("/home/rasmus/file.txt", "r"); +$handle = fopen("/home/rasmus/file.gif", "wb"); +$handle = fopen("http://www.example.com/", "r"); +$handle = fopen("ftp://user:password@example.com/somefile.txt", "w"); ?> ]]> </programlisting> @@ -244,12 +244,13 @@ <programlisting role="php"> <![CDATA[ <?php -$handle = fopen ("c:\\data\\info.txt", "r"); +$handle = fopen("c:\\data\\info.txt", "r"); ?> ]]> </programlisting> </informalexample> </para> + ¬e.sm.uidcheck.dir; <simpara> Vedere anche <xref linkend="wrappers"/>, <function>fclose</function>, http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/fpassthru.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/fpassthru.xml diff -u phpdoc-it/reference/filesystem/functions/fpassthru.xml:1.2 phpdoc-it/reference/filesystem/functions/fpassthru.xml:1.3 --- phpdoc-it/reference/filesystem/functions/fpassthru.xml:1.2 Wed Apr 17 03:06:38 2002 +++ phpdoc-it/reference/filesystem/functions/fpassthru.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'fpassthru' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.7 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.fpassthru"> <refnamediv> @@ -12,15 +12,17 @@ <title>Descrizione</title> <methodsynopsis> <type>int</type><methodname>fpassthru</methodname> - <methodparam><type>int</type><parameter>fp</parameter></methodparam> + <methodparam><type>resource</type><parameter>handle</parameter></methodparam> </methodsynopsis> <simpara> - Legge fino a EOF sul puntatore al file dato e scrive i risultati sullo - standard output. + Legge fino a EOF sul puntatore al file dato e scrive i risultati sul buffer di + output. </simpara> <simpara> Se si verifica un errore, <function>fpassthru</function> restituisce - &false;. + &false;. In caso positivo <function>fpassthru</function> restituisce + il numero di caratteri letti da <parameter>handle</parameter> scritti + in output. </simpara> <simpara> Il puntatore al file deve essere valido e deve puntare ad un file @@ -29,21 +31,51 @@ <function>rewind</function> to reset the file pointer to the beginning of the file if you have already written data to the file. Il file viene chiuso quando <function>fpassthru</function> viene conclusa - la sua lettura (lasciando <parameter>fp</parameter> inutilizzato). + la sua lettura (lasciando <parameter>handle</parameter> inutilizzato). </simpara> <simpara> - Se desideri semplicemente inviare il contenuto di un file sullo stdout, + Se desideri semplicemente inviare il contenuto di un file sul buffer di output, + senza doverlo modificare o posizionarti in un particolare offset, potresti preferire <function>readfile</function>, che ti salva la chiamata a <function>fopen</function>. </simpara> <note> <para> - When using <function>fpassthru</function> on a binary file on Windows - systems, you should make sure to open the file in binary mode by - appending a <literal>b</literal> to the mode used in the call to + Quando si utilizza <function>fpassthru</function> con file binari su sistemi Windows + si dovrebbe essere certi di aprire il file in modalità binaria + aggiungendo <literal>b</literal> alla modalità utilizzata nella chiamata a <function>fopen</function>. </para> + <para> + Si incoraggia l'uso del flag <literal>b</literal> quando si trattano file binari, + anche se il sistema non lo richiede; in questo modo si rendono gli script + più trasportabili. + </para> </note> + <para> + <example> + <title>Utilizzo di <function>fpassthru</function> con file binari</title> + <programlisting role="php"> +<![CDATA[ +<?php + +// apre il file in modalità binaria +$name = ".\public\dev\img\ok.png"; +$fp = fopen($name, 'rb'); + +// invia i giusti header +header("Content-Type: image/png"); +header("Content-Length: " . filesize($name)); + +// invia l'immagine ed esce dallo script +fpassthru($fp); +exit; + +?> +]]> + </programlisting> + </example> + </para> <simpara> Vedere anche <function>readfile</function>, <function>fopen</function>, <function>popen</function> e http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/fputs.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/fputs.xml diff -u phpdoc-it/reference/filesystem/functions/fputs.xml:1.2 phpdoc-it/reference/filesystem/functions/fputs.xml:1.3 --- phpdoc-it/reference/filesystem/functions/fputs.xml:1.2 Wed Apr 17 03:06:38 2002 +++ phpdoc-it/reference/filesystem/functions/fputs.xml Fri Jan 23 15:22:39 2004 @@ -1,26 +1,17 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'fputs' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.5 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.2 --> <refentry id="function.fputs"> <refnamediv> <refname>fputs</refname> - <refpurpose>Scrive su un puntatore a file</refpurpose> + <refpurpose>Alias di <function>fwrite</function></refpurpose> </refnamediv> <refsect1> <title>Descrizione</title> - <methodsynopsis> - <type>int</type><methodname>fputs</methodname> - <methodparam><type>int</type><parameter>fp</parameter></methodparam> - <methodparam><type>string</type><parameter>str</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam> - </methodsynopsis> <para> - <function>fputs</function> è un alias di - <function>fwrite</function> del tutto identico. Nota che il parametro - <parameter>length</parameter> è opzionale e se non specificato verrà scritta - l'intera stringa. + <function>fputs</function> è un alias di <function>fwrite</function>. </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/filesystem/functions/ftruncate.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-it/reference/filesystem/functions/ftruncate.xml diff -u phpdoc-it/reference/filesystem/functions/ftruncate.xml:1.2 phpdoc-it/reference/filesystem/functions/ftruncate.xml:1.3 --- phpdoc-it/reference/filesystem/functions/ftruncate.xml:1.2 Wed Apr 17 03:06:39 2002 +++ phpdoc-it/reference/filesystem/functions/ftruncate.xml Fri Jan 23 15:22:39 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 --> <!-- last change to 'ftruncate' in en/ tree in rev 1.14 --> -<!-- EN-Revision: 1.2 Maintainer: cortesi Status: working --> +<!-- EN-Revision: 1.6 Maintainer: cortesi Status: working --> <!-- OLD-Revision: 1.134/EN.1.14 --> <refentry id="function.ftruncate"> <refnamediv> @@ -11,14 +11,25 @@ <refsect1> <title>Descrizione</title> <methodsynopsis> - <type>int</type><methodname>ftruncate</methodname> - <methodparam><type>int</type><parameter>fp</parameter></methodparam> + <type>bool</type><methodname>ftruncate</methodname> + <methodparam><type>resource</type><parameter>handle</parameter></methodparam> <methodparam><type>int</type><parameter>size</parameter></methodparam> </methodsynopsis> <para> - Prende il puntatore al file <parameter>fp</parameter> e tronca il file - alla lunghezza indicata da <parameter>size</parameter>. Questa funzione - restituisce &true; in caso di successo e &false; altrimenti. + Prende il puntatore al file <parameter>handle</parameter> e tronca il file + alla lunghezza indicata da <parameter>size</parameter>. + &return.success; + </para> + <note> + <para> + Nelle versioni di PHP precedenti alla 4.3.3, la funzione <function>ftruncate</function> + restituisce un <type>integer</type> di valore 1 se l'operazione riesce, anziché + restituire <type>boolean</type> &true;. + </para> + </note> + <para> + See also <function>fopen</function> and + <function>fseek</function>. </para> </refsect1> </refentry>