How can I introduce the same php file to php in different folders? As the website requires, I want to go to www/sub. www/includes/application_top.php is introduced in php, but this will cause a path error. I am using zencart. how can I solve this problem?
Reply to discussion (solution)
Introduce www/shortdes/application_top.php in www/sub. php
Require '../schemdes/application_top.php ';
We recommend that you paste the error information for analysis.
I mean, without changing or modifying the code in application_top.php as little as possible, it will not cause any path errors if php references this file in depth, such as www/sub. php reference .. /includes/application_top.php will report an error.. php and B. php
An error has been written in application_top.php. it should be:
Require ('A. php ');
Require ('B. php ');
Your project has access to the upper-level directory from the lower-level directory, which shows that your Directory design is unreasonable.
The reasonable design is always the upper-layer access lower-layer
If you cannot avoid it, you can
1. set the constant ROOT_PATH in the public (usually comfig. php) for file introduction.
2. execute
Ini_set ('include _ path', ini_get ('include _ path'). PATH_SEPARATOR. '/www /'));
Dynamically set search path
3. if possible, set include_path directly in php. ini.
Thank you, two cool people.