Skip to content

Commit 6df6f16

Browse files
committed
first traduction dirname
1 parent c268b1f commit 6df6f16

File tree

1 file changed

+171
-72
lines changed

1 file changed

+171
-72
lines changed

reference/filesystem/functions/dirname.xml

Lines changed: 171 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,181 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<!-- splitted from ./it/functions/filesystem.xml, last change in rev 1.15 -->
3-
<!-- EN-Revision: n/a Maintainer: cortesi Status: working -->
4-
<refentry xml:id="function.dirname" xmlns="http://docbook.org/ns/docbook">
5-
<refnamediv>
6-
<refname>dirname</refname>
7-
<refpurpose>Restituisce il nome della directory dal percorso indicato</refpurpose>
8-
</refnamediv>
9-
<refsect1>
10-
<title>Descrizione</title>
11-
<methodsynopsis>
12-
<type>string</type><methodname>dirname</methodname>
13-
<methodparam><type>string</type><parameter>path</parameter></methodparam>
14-
</methodsynopsis>
15-
<para>
16-
Data una stringa contenente il percorso di un file, questa funzione
17-
restituirà il nome della directory.
18-
</para>
19-
<para>
20-
Su windows sia gli slash (<literal>/</literal>) che i backslash
21-
(<literal>\</literal>) vengono utilizzati come caratteri di separazione nei
22-
percorsi. In altri ambienti, c'è solo lo slash in avanti
23-
(<literal>/</literal>).
24-
</para>
25-
<para>
26-
<example>
27-
<title><function>dirname</function> example</title>
28-
<programlisting role="php">
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- EN-Revision: 130701dd4e64351d38da565ab3043a8f795698f8 Maintainer: ManueldG Status: ready -->
3+
<!-- Reviewed: no -->
4+
<!-- CREDITS: cortesi -->
5+
<refentry xml:id="function.dirname" xmlns="http://docbook.org/ns/docbook">
6+
<refnamediv>
7+
<refname>dirname</refname>
8+
<refpurpose>Ritorna il path del livello superiore della directory</refpurpose><!-- genitore - antenato - livello -->
9+
</refnamediv>
10+
11+
<refsect1 role="description">
12+
&reftitle.description;
13+
<methodsynopsis>
14+
<type>string</type><methodname>dirname</methodname>
15+
<methodparam><type>string</type><parameter>path</parameter></methodparam>
16+
<methodparam choice="opt"><type>int</type><parameter>levels</parameter><initializer>1</initializer></methodparam>
17+
</methodsynopsis>
18+
<para>
19+
Data una stringa contenente il percorso di un file o una directory, questa funzione
20+
restituirà il percorso della directory superiore
21+
<parameter>levels</parameter> più in su della directory corrente.
22+
</para>
23+
<note>
24+
<para>
25+
<function>dirname</function> opera nativamente sulla stringa d'ingresso,
26+
e senza conoscere l'attuale filesystem, o componenti del percorso
27+
come "<literal>..</literal>".
28+
</para>
29+
</note>
30+
<caution>
31+
<para>
32+
In Windows, <function>dirname</function> presuppone la codepage attualmente
33+
impostata, quindi affinché veda il nome di directory corretto con percorsi
34+
di caratteri multibyte, deve essere impostata la codepage corrispondente.
35+
Se <parameter>path</parameter> contiene caratteri non validi per la codepage
36+
corrente, il comportamento di <function>dirname</function> non è definito.
37+
38+
On Windows, <function>dirname</function> assumes the currently set codepage, so for it to see the
39+
correct directory name with multibyte character paths, the matching codepage must
40+
be set.
41+
If <parameter>path</parameter> contains characters which are invalid for the
42+
current codepage, the behavior of <function>dirname</function> is undefined.
43+
</para>
44+
<para>
45+
negli altri sistemi operativi, nella funzione <function>dirname</function> si presume che <parameter>path</parameter>
46+
dev'essere in un formato ASCII compatibile. Altrimenti il comportamnto
47+
della funzione è imprevedibile.
48+
</para>
49+
</caution>
50+
</refsect1>
51+
52+
<refsect1 role="parameters">
53+
&reftitle.parameters;
54+
<para>
55+
<variablelist>
56+
<varlistentry>
57+
<term><parameter>path</parameter></term>
58+
<listitem>
59+
<para>
60+
A path.
61+
</para>
62+
<para>
63+
Su Windows, sia slash (<literal>/</literal>) che backslash
64+
(<literal>\</literal>) sono usati come separatore di directory. In
65+
altri ambienti, è lo slash (<literal>/</literal>).
66+
</para>
67+
</listitem>
68+
</varlistentry>
69+
<varlistentry>
70+
<term><parameter>levels</parameter></term>
71+
<listitem>
72+
<para>
73+
Il numero di livelli da salire.
74+
</para>
75+
<para>
76+
Questo dev'essere un'intero maggiore di 0.
77+
</para>
78+
</listitem>
79+
</varlistentry>
80+
</variablelist>
81+
</para>
82+
</refsect1>
83+
84+
<refsect1 role="returnvalues">
85+
&reftitle.returnvalues;
86+
<para>
87+
Restituisce il percorso di una directory padre. Se non ci sono barre in
88+
<parameter>path</parameter>, viene restituito un punto ('<literal>.</literal>'), che
89+
indica la directory corrente. In caso contrario, la stringa restituita è
90+
<parameter>path</parameter> con qualsiasi
91+
<literal>/component</literal> finale rimosso.
92+
</para>
93+
94+
<caution>
95+
<para>
96+
Fai attenzione quando usi questa funzione in un ciclo che può raggiungere
97+
la directory di livello superiore perché potrebbe causare un ciclo infinito.
98+
<informalexample>
99+
<programlisting role="php">
29100
<![CDATA[
30101
<?php
31-
$path = "/etc/passwd";
32-
$file = dirname($path); // $file contiene "/etc"
102+
dirname('.'); // Restituirà '.'.
103+
dirname('/'); // Restituirà `\` su Windows e '/' su sistemi *nix .
104+
dirname('\\'); // Restituirà `\` su Windows e '.' su sistemi *nix.
105+
dirname('C:\\'); // Restituirà 'C:\' su Windows e '.' su sistemi *nix.
33106
?>
34107
]]>
35-
</programlisting>
36-
</example>
37-
</para>
38-
<note>
39-
<para>
40-
In PHP 4.0.3, la funzione <function>dirname</function> è stata modificata per essere conforme alle specifiche
41-
POSIX. Essenzialmente ciò significa che non ci sono slash
42-
nel parametro <parameter>path</parameter> , viene restituito un punto
43-
('<literal>.</literal>') per indicare la directory
44-
corrente. In altro modo, la stringa restituita è
45-
<parameter>path</parameter> senza alcun
46-
<literal>/component</literal>. Occorre notare che ciò implica che spesso
47-
dalla funzione <function>dirname</function> si ottiene uno slash od un punto nei casi
48-
in cui la vecchia versione avrebbe restituito una
49-
stringa vuota.
50-
</para>
51-
</note>
52-
<para>
53-
<function>dirname</function> ha modificato il suo comportamento dal PHP 4.3.0.
54-
Controllare l'esempio:
55-
<informalexample>
56-
<programlisting role="php">
108+
</programlisting>
109+
</informalexample>
110+
</para>
111+
</caution>
112+
</refsect1>
113+
114+
<refsect1 role="changelog">
115+
&reftitle.changelog;
116+
<para>
117+
<informaltable>
118+
<tgroup cols="2">
119+
<thead>
120+
<row>
121+
<entry>&Version;</entry>
122+
<entry>&Description;</entry>
123+
</row>
124+
</thead>
125+
<tbody>
126+
<row>
127+
<entry>7.0.0</entry>
128+
<entry>
129+
Aggiunto il parametro optionale <parameter>levels</parameter>.
130+
</entry>
131+
</row>
132+
</tbody>
133+
</tgroup>
134+
</informaltable>
135+
</para>
136+
</refsect1>
137+
138+
<refsect1 role="examples">
139+
&reftitle.examples;
140+
<para>
141+
<example>
142+
<title><function>dirname</function> Esempio</title>
143+
<programlisting role="php">
57144
<![CDATA[
58145
<?php
59-
60-
//prima del PHP 4.3.0
61-
dirname('c:/'); // restituisce '.'
62-
63-
//dopo il PHP 4.3.0
64-
dirname('c:/'); // restituisce 'c:'
65-
66-
?>
146+
echo dirname("/etc/passwd") . PHP_EOL;
147+
echo dirname("/etc/") . PHP_EOL;
148+
echo dirname(".") . PHP_EOL;
149+
echo dirname("C:\\") . PHP_EOL;
150+
echo dirname("/usr/local/lib", 2);
151+
]]>
152+
</programlisting>
153+
&example.outputs.similar;
154+
<screen>
155+
<![CDATA[
156+
/etc
157+
/ (or \ in Windows)
158+
.
159+
C:\
160+
/usr
67161
]]>
68-
</programlisting>
69-
</informalexample>
70-
</para>
71-
<para>
72-
<function>dirname</function> è sicura con i dati binari dal PHP 5.0.0
73-
</para>
74-
<para>
75-
Vedere anche: <function>basename</function>, <function>pathinfo</function> e
76-
<function>realpath</function>.
77-
</para>
78-
</refsect1>
79-
</refentry>
162+
</screen>
163+
</example>
164+
</para>
165+
</refsect1>
166+
167+
<refsect1 role="seealso">
168+
&reftitle.seealso;
169+
<para>
170+
<simplelist>
171+
<member><function>basename</function></member>
172+
<member><function>pathinfo</function></member>
173+
<member><function>realpath</function></member>
174+
</simplelist>
175+
</para>
176+
</refsect1>
177+
178+
</refentry>
80179

81180
<!-- Keep this comment at the end of the file
82181
Local variables:

0 commit comments

Comments
 (0)