Directory structure,
- A.php
- folder
- B.php
- C.php
A.php includes B.php and B.php includes C.php.
But B.php needs to include C.php relative to A.php. Is there any way I can include C.php relative to B.php?
Directory structure,
A.php includes B.php and B.php includes C.php.
But B.php needs to include C.php relative to A.php. Is there any way I can include C.php relative to B.php?
You can include using __DIR__
or dirname(__FILE__)
.
From the manual
The directory of the file. If used inside an include, the directory of the included file is returned. This is equivalent to
dirname(__FILE__)
.