Re: questions about $_SERVER
| From: | Michael Save | Date: | Mon, 13 Feb 2012 07:10:15 +0000 |
| Subject: | Re: questions about $_SERVER | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316579@lists.php.net to get a copy of this message | ||
On Mon, Feb 13, 2012 at 5:28 PM, Rui Hu <tchrbupt@gmail.com> wrote:
> hi,
>
> How PHP sets variables in $_SERVER, say, $DOCUMENT_ROOT? What should I know
> if I want to modify $_SERVER myself?
>
> Thanks!
>
>
> --
> Best regards,
>
> Rui Hu
> ----------------------------------------------------------------------------------------
> State Key Laboratory of Networking & Switching Technology
> Beijing University of Posts and Telecommunications(BUPT)
> MSN: tchrbupt@gmail.com
> -----------------------------------------------------------------------------------------
Rui,
$_SERVER is an associative array. You can access "DOCUMENT_ROOT" with
$_SERVER['DOCUMENT_ROOT']. It contains the document root directory
under which the current script is executing.
You can make changes to the $_SERVER array but it will have no effect
on PHP itself. I mean, you can change the value of
$_SERVER['DOCUMENT_ROOT'] to whatever you want at runtime, but of
course it will not actually change the current directory if that's
what you're after.
Thanks,
Michael