php-doc-en/reference/info/functions/getenv.xml
2005-01-18 17:53:28 +00:00

66 lines
1.9 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/info.xml, last change in rev 1.2 -->
<refentry id="function.getenv">
<refnamediv>
<refname>getenv</refname>
<refpurpose>Gets the value of an environment variable</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>getenv</methodname>
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
</methodsynopsis>
<para>
Returns the value of the environment variable
<parameter>varname</parameter>, or &false; on an error.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
// Example use of getenv()
$ip = getenv('REMOTE_ADDR');
// Or simply use a Superglobal ($_SERVER or $_ENV)
$ip = $_SERVER['REMOTE_ADDR'];
?>
]]>
</programlisting>
</informalexample>
</para>
<para>
You can see a list of all the environmental variables by using
<function>phpinfo</function>. You can find out what many of them
mean by taking a look at the <ulink url="&url.cgispecs;">CGI
specification</ulink>, specifically the <ulink
url="&url.cgispec;">page on environmental variables</ulink>.
</para>
<para>
See also <function>putenv</function>,
<function>apache_getenv</function>&listendand;
<link linkend="language.variables.superglobals">Superglobals</link>.
</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:"../../../../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
-->