Search code examples
phprequire-once

Force php to look at Document Root


So I was messing around with the twitter api, and I want to include this file in the footer for every page. The footer is loaded via phps require_once function. The problem is I can't use a full url because of url file acsess being turned off for obvious reasons. So I tried to use

require_once $_SERVER['DOCUMENT_ROOT']('/lib/twitter/base.php');

But that failed. What am I doing wrong or how can I do this better?


Solution

  • Try this:

    require_once($_SERVER['DOCUMENT_ROOT'].'/lib/twitter/base.php');