DOCUMENT_ROOT

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

DOCUMENT_ROOT

Post by JellyFish »

I was wondering if there was a shorter version of $_SERVER['DOCUMNET_ROOT'] defined somewhere globally by php? It's kinda a hassle typing all those bracket characters, single-quotes, underscores, and stuff. So I was wondering if there was some kind of global variable for this something shorter, like DOCUMENT_ROOT or $DOCUMENT_ROOT or something. I try googling it but all I get is $_SERVER['DOCUMENT_ROOT'], so I'm assuming there isn't such a thing as what I'm asking for.

But I thought I'd throw this out to DevNetwork (seeing as how you guys are so smart o_-). If not I'll just keep using $_SERVER['DOCUMNET_ROOT'], it's better then having to type /home/b/l/a/blablabla/html for every include statement.

Thanks.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: DOCUMENT_ROOT

Post by Benjamin »

Code: Select all

 
define('DROOT', $_SERVER['DOCUMENT_ROOT']);
 
echo DROOT;
 
Post Reply