tarun Posted April 22, 2007 Share Posted April 22, 2007 Its more typing that way, sometimes ../ is better, but, say you want to call up a page from 3 different locations on your server, a stats page for example. if you use ../stats.php, wherever you call it up from it will think that you mean ../ relative to that location, if you use $_SERVER['DOCUMENT_ROOT'] it will know exactly where the page you are looking for is located. ../ is mostly guesswork, that is why I prefer the $_SERVER method. Okay I Saw This Quote Somewhere And It Exactly What I Need Answering Who Could I Use $_SERVER To Do The Above AnyHelp Thnx, Tarun Link to comment https://forums.phpfreaks.com/topic/48168-include-from-multiple-locations/ Share on other sites More sharing options...
genericnumber1 Posted April 22, 2007 Share Posted April 22, 2007 Some people like to do require $_SERVER['document_root'] . '/path/to/my/file.php'; this isn't what I do but I'll spare you the explanation and just leave it at that Link to comment https://forums.phpfreaks.com/topic/48168-include-from-multiple-locations/#findComment-235477 Share on other sites More sharing options...
tarun Posted April 23, 2007 Author Share Posted April 23, 2007 Some people like to do require $_SERVER['document_root'] . '/path/to/my/file.php'; this isn't what I do but I'll spare you the explanation and just leave it at that Rather Than "require" I NEED!!! To Use "file" Link to comment https://forums.phpfreaks.com/topic/48168-include-from-multiple-locations/#findComment-236114 Share on other sites More sharing options...
genericnumber1 Posted April 23, 2007 Share Posted April 23, 2007 ... then do it? $file = file($_SERVER['document_root'] . '/path/to/my/file.php'); Link to comment https://forums.phpfreaks.com/topic/48168-include-from-multiple-locations/#findComment-236307 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.