0

If I include files with

include('test.php');

it works, but when I try to include it using relative paths

include('./test.php');

It doesn't, as neither it does if I try to include files from parent folders

include('../test.php'); (once moved the file)

I am on Windows, so I tested just in case

include('.\test.php');

include('.\\test.php');

But got the same failed result (failed to open stream: No such file or directory)

*This is executing this within a wordpress plugin


Then this works if using

include(dirname(__FILE__) . './test.php');

Why? What's the reasoning?

GWorking
  • 4,011
  • 10
  • 49
  • 90

0 Answers0