I’m new to PHP. I’m developing a new PHP website. My website folder structure is as below,
-SystemRoot
+Code
+Data_Access
-Public_HTML
+css
+js
+Templates
-resources
config.php
There I have a config file in resources directory, I need to include config.php in most of other php pages in various directories. So I have to specify the path to config file differently in different pages like,
include_once '../resources/config.php';
include_once '../../resources/config.php';
Is there a way to overcome this & use a common (relative) path to config.php that can be used in eny folder path within the project?
What is the common/best practice to include classes in php projects?
You could route everything to your index.php
then define some constant’s. Evrything routed to index.php will have access to these then.