note 92829 added to reserved.variables.server
| From: | jarrod at squarecrow dot com | Date: | Tue, 11 Aug 2009 03:31:21 +0000 |
| Subject: | note 92829 added to reserved.variables.server | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159307@lists.php.net to get a copy of this message | ||
$_SERVER['DOCUMENT_ROOT'] is incredibly useful especially when working in your development
environment. If you're working on large projects you'll likely be including a large number
of files into your pages. For example:
<?
//Defines constants to use for "include" URLS - helps keep our paths clean
define("REGISTRY_CLASSES",
$_SERVER['DOCUMENT_ROOT']."/SOAP/classes/");
define("REGISTRY_CONTROLS",
$_SERVER['DOCUMENT_ROOT']."/SOAP/controls/");
define("STRING_BUILDER", REGISTRY_CLASSES. "stringbuilder.php");
define("SESSION_MANAGER", REGISTRY_CLASSES. "sessionmanager.php");
define("STANDARD_CONTROLS", REGISTRY_CONTROLS."standardcontrols.php");
?>
In development environments, you're rarely working with your root folder, especially if
you're running PHP locally on your box and using DOCUMENT_ROOT is a great way to maintain URL
conformity. This will save you hours of work preparing your application for deployment from your box
to a production server (not to mention save you the headache of include path failures).
----
Server IP: 208.69.120.35
Probable Submitter: 98.215.60.105
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.server.php
Edit -- https://master.php.net/note/edit/92829
Del: integrated -- https://master.php.net/note/delete/92829/integrated
Del: useless -- https://master.php.net/note/delete/92829/useless
Del: bad code -- https://master.php.net/note/delete/92829/bad+code
Del: spam -- https://master.php.net/note/delete/92829/spam
Del: non-english -- https://master.php.net/note/delete/92829/non-english
Del: in docs -- https://master.php.net/note/delete/92829/in+docs
Del: other reasons-- https://master.php.net/note/delete/92829
Reject -- https://master.php.net/note/reject/92829
Search -- https://master.php.net/manage/user-notes.php