_ FILE __indicates the complete path and FILE name of the returned FILE. If it is used in a include file, the include file name is returned. Starting from PHP4.0.2, __file _ always contains an absolute path. earlier versions sometimes contain a relative path _ FILE _, which is the complete path and FILE name of the returned FILE. If it is used in a include file, the include file name is returned. Starting from PHP 4.0.2, __file _ always contains an absolute path, while earlier versions sometimes contain a relative path. Dirname (_ FILE _) returns part of the current FILE path, that is, removing the FILE name.
Demo code:
The code is as follows:
// Obtain the current file path + file name
Echo _ FILE __;
Echo'
';
// Obtain the current path of the object
Echo dirname (_ FILE __);
Echo'
';
// Obtain the directory path of the file at the upper level
Echo dirname (_ FILE __));
?>
Running result:
The code is as follows:
D: \ wamp \ www \ index. php
D: \ wamp \ www
D: \ wamp
_ FILE _ can be used to obtain the current path of the FILE, which is not changed even if it is included. it can be used as the absolute path of the website on the server. other directories are distributed on this basis.