php-doc-en/reference/var/functions/import-request-variables.xml
Philip Olson 555d51632c See also $_REQUEST
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@87347 c90b9560-bf6c-de11-be94-00142212c4b1
2002-07-01 18:10:17 +00:00

96 lines
3.4 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/var.xml, last change in rev 1.34 -->
<refentry id="function.import-request-variables">
<refnamediv>
<refname>import_request_variables</refname>
<refpurpose>Import GET/POST/Cookie variables into the global scope</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>import_request_variables</methodname>
<methodparam><type>string</type><parameter>types</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>prefix</parameter></methodparam>
</methodsynopsis>
<simpara>
Imports GET/POST/Cookie variables into the global scope. It is
useful if you disabled
<link linkend="ini.register-globals">register_globals</link>,
but would like to see some variables in the global scope.
</simpara>
<simpara>
Using the <parameter>types</parameter> parameter, you can
specify which request variables to import. You can use
'G', 'P' and 'C' characters respectively for GET, POST and
Cookie. These characters are not case sensitive, so you
can also use any combination of 'g', 'p' and 'c'. POST
includes the POST uploaded file information. Note that the
order of the letters matters, as when using "gp", the POST
variables will overwrite GET variables with the same
name. Any other letters than GPC are discarded.
</simpara>
<simpara>
The <parameter>prefix</parameter> parameter is used as a variable
name prefix, prepended before all variable's name imported into the
global scope. So if you have a GET value named "userid", and provide
a prefix "pref_", then you'll get a global variable named
$pref_userid.
</simpara>
<simpara>
If you're interested in importing other variables
into the global scope, such as SERVER, consider using
<function>extract</function>.
</simpara>
<note>
<para>
Although the <parameter>prefix</parameter> parameter is
optional, you will get an
<link linkend="internal.e-notice">E_NOTICE</link> level error if
you specify no prefix, or specify an empty string as a
prefix. This is a possible security hazard. Notice
level errors are not displayed using the default
<link linkend="ini.error-reporting">error reporting</link>
level.
</para>
</note>
<informalexample>
<programlisting role="php">
<![CDATA[
// This will import GET and POST vars
// with an "rvar_" prefix
import_request_variables("gP", "rvar_");
print $rvar_foo;
]]>
</programlisting>
</informalexample>
<simpara>
See also <link linkend="reserved.variables.request">$_REQUEST</link>,
<link linkend="ini.register-globals">register_globals</link>,
<link linkend="language.variables.predefined">Predefined Variables</link>,
and <function>extract</function>.
</simpara>
</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:"../../../../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
-->