mirror of
https://github.com/php/doc-it.git
synced 2026-03-24 15:42:46 +01:00
* Update oop5.xml * Update types.xml * Update fgetcsv.xml * Update bcdiv.xml * Update bcadd.xml and gmp-init.xml * Update ini.xml * Remove a file not in the EN tree * Fix credits section * Update get-magic-quotes-runtime.xml * Remove useless section * Update addslashes.xml * Update ini.core.xml * Update fwrite.xml * Remove ini.magic-quotes-gpc reference from language-snippets.ent * Update stripslashes.xml * Update parse-str.xml * Update oci-bind-by-name.xml
195 lines
5.1 KiB
XML
195 lines
5.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: e35fbbaa52702ebf45c5e7284351e136ed67f3bb Maintainer: pastore Status: ready -->
|
|
<!-- CREDITS: darvina -->
|
|
<refentry xml:id="function.parse-str" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>parse_str</refname>
|
|
<refpurpose>Effettua il parsing della stringa in variabili</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>parse_str</methodname>
|
|
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter role="reference">result</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Suddivide la stringa <parameter>string</parameter> come se fosse una query string
|
|
passata via URL ed imposta le variabili nell'ambito corrente (o nell'array
|
|
se è fornito il parametro <parameter>result</parameter>).
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>string</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La stringa di input.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>result</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Se è presente il secondo parametro <parameter>result</parameter>,
|
|
le variabili vengono invece memorizzate in questa variabile come elementi dell'array.
|
|
</para>
|
|
|
|
<warning>
|
|
<para>
|
|
L'uso di questa funzione senza il parametro <parameter>result</parameter> è fortemente
|
|
<emphasis>NON CONSIGLIATO</emphasis> e <emphasis>DEPRECATO</emphasis> a partire da PHP 7.2.
|
|
A partire da PHP 8.0.0, il parametro <parameter>result</parameter> è <emphasis>OBBLIGATORIO</emphasis>.
|
|
</para>
|
|
</warning>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.void;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.0.0</entry>
|
|
<entry>
|
|
<parameter>result</parameter> non è più opzionale.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>7.2.0</entry>
|
|
<entry>
|
|
L'uso di <function>parse_str</function> senza un secondo parametro
|
|
ora genera un avviso <constant>E_DEPRECATED</constant>.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Utilizzo di <function>parse_str</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$str = "first=value&arr[]=foo+bar&arr[]=baz";
|
|
|
|
// Consigliato
|
|
parse_str($str, $output);
|
|
echo $output['first']; // value
|
|
echo $output['arr'][0]; // foo bar
|
|
echo $output['arr'][1]; // baz
|
|
|
|
// NON CONSIGLIATO
|
|
parse_str($str);
|
|
echo $first; // value
|
|
echo $arr[0]; // foo bar
|
|
echo $arr[1]; // baz
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Poiché le variabili in PHP non possono contenere punti e spazi nei loro nomi,
|
|
questi vengono convertiti in underscore. Lo stesso vale per la denominazione delle
|
|
rispettive chiavi nell'array quando si usa questa funzione con il
|
|
parametro <parameter>result</parameter>.
|
|
<example>
|
|
<title><function>parse_str</function> name mangling</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
parse_str("My Value=Something");
|
|
echo $My_Value; // Something
|
|
|
|
parse_str("My Value=Something", $output);
|
|
echo $output['My_Value']; // Something
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
|
|
<note>
|
|
<para>
|
|
Su tutte le variabili create (o i valori restituiti nell'array se è impostato il secondo parametro)
|
|
sarà già eseguita la funzione <function>urldecode</function>.
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
Per ottenere la <literal>QUERY_STRING</literal> corrente, puoi usare la variabile
|
|
<varname>$_SERVER['QUERY_STRING']</varname>.
|
|
Inoltre, potrebbe essere utile leggere la sezione su
|
|
<link linkend="language.variables.external">variabili da fonti
|
|
esterne</link>.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>parse_url</function></member>
|
|
<member><function>pathinfo</function></member>
|
|
<member><function>http_build_query</function></member>
|
|
<member><function>urldecode</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
--> |