Search code examples
phpbb3

How can I get "DOCUMENT_ROOT" in phpbb 3.1?


I have tried to use this

require $_SERVER['DOCUMENT_ROOT'] . '/lib/MyClass.php';

But I got this message

Illegal use of $_SERVER. You must use the request class or request_var() to access input data

I have attempted to use request_var(), but it doesn't work.

How can I get "DOCUMENT_ROOT" in phpbb 3.1 ?


Solution

  • I have found the next decision of this problem - use filter_input instead of $_SERVER.

      require filter_input(INPUT_SERVER, 'DOCUMENT_ROOT') . '/lib/MyClass.php';