__FILE__:
explanation: the full path and file name of the file. If used in the include file, the include filename is returned. Since PHP 4.0.2, __file__ always contains an absolute path, and the previous version sometimes contains a relative path.
String dirname (String path)
Explanation: Given a string containing a full path to a file, this function returns the directory name after the file name has been removed.
Note: in Windows, slashes (/) and backslashes (\) can be used as directory separators. In other environments it is a slash (/).
If you use dirname for nesting?
dirname (DirName (__file__));
Assume __file__ is/wwwhome/web/config/config.php
The method output is/wwwhome/web
DirName (dirname (__file__)), which is the top directory name
DirName (__file__) of the file, and the directory name
Summary: We all know that the folder List and file list will be listed when you enter Dir under DOS, and the parameters in the DirName function will also be processed if they are folder names. That is, you can use this function if you want to get a parent directory of this level of directory
PHP dirname (__file__)