1

Just a thought but it occurred to me that when I wanted to define the document root for a website that I could use the $_SERVER['DOCUMENT_ROOT'] and it works fine on a live host.

Then I thought why not just use a simple:

define('SITEPATH,'http://www.site.co.uk');

The define method works fine with no need to use document root.

Am I missing something? Or is it just a matter or personal preference?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
kappicraig
  • 11
  • 3

1 Answers1

0

Because the SITEPATH allow you to create URL.

But when you want include another PHP file you need a system path to do that.

Samuel Dauzon
  • 10,744
  • 13
  • 61
  • 94
  • Hi Jedema,thanks for the reply. Not too sure I understand. So you are saying I can't use a defined path as part of a php include, is that correct? Thanks – kappicraig Jun 20 '14 at 12:24
  • No, sorry for confusing. I want to say both can be usefull : include($_SERVER['DOCUMENT_ROOT']."include/db.php"); link We must just use these in the good situation. – Samuel Dauzon Jun 20 '14 at 12:32
  • You're welcome it was a pleasure. Don't forget check question is fixed ;) – Samuel Dauzon Jun 20 '14 at 12:43