It is usually very effective to use dirname(__FILE__) when configuring the file path. However, because the path of __FILE__ is the full path of the file where the current code is located (not the file where the url is located), the defined configuration file is usually placed in the root directory. Define the root address of the website, but the following method can solve the problem of storing the configuration file.
dirname(dirname(__FILE__)); /*
Assume __FILE__ is /home/web/config/config.php
The output of the above method is /home/web
*/
dirname(dirname(__FILE__)); What you get is the name of the directory above the file
dirname(__FILE__); What you get is the name of the directory where the file is located