Posted by FP on 12/18/19 11:50
I have the following files;
\A.php
\F1\B.php
\F1\F1_1\C.php
File A has the lines "echo 'A'; include_once('F1/B.php');"
File B has the lines "echo 'B'; include_once('F2/C.php');"
File C has the line "echo 'C';"
If I open file A in my browser I get "ABC".
If I open file B in my browser I get "BC".
So far so good.
I also have files;
\D.php
\F1\E.php
\F1\F1_1\F.php
File D has the lines "echo 'D'"
File E has the lines "echo 'E'; include_once('../D.php');"
File F has the line "echo 'F'; include_once('../E.php');"
If I open file E in my browser I get "ED".
If I open file F in my browser I get "FE" and an error saying file D
doesn't exist.
If I change the include portion of file E to '../../D.php' then I get
"FED".
Is this how PHP is suppose to work?
I have several files at the root level including a "SetupData.php" file
in which I need to specify IPs, passwords etc.
I have a directory "FX" and the file "ImageProxy.php" inside it.
The "ImageProxy.php" file is used as an include by files at the root
level but also called directly.
The "ImageProxy.php" file requires passwords stored in the
"SetupData.php" file.
How do I get the "ImageProxy.php" file to access the variables in the
"SetupData.php" file?
As far as I can tell it's possible to include a file by full path, if
possible I would like to avoid that, are there any other ways?
[Back to original message]
|