How to check the path of php file?
__FILE__ means the absolute path of the current file including the file name, dirname (__FILE__) represents the absolute path of the current file.
dirname(__FILE___) function returns the path where the script is located.
For example, the file b.php contains the following content:
<?php $basedir = dirname(__FILE__); ?>
If b.php is referenced by the a.php file require or include in other directories.
The content of the variable $basedir is still the path to the folder where b.php is located.
Instead of becoming the directory where the a.php file is located.
For more PHP related knowledge, please visit PHP Tutorial!
The above is the detailed content of How to check the path of php file. For more information, please follow other related articles on the PHP Chinese website!