The dirname, realpath, and FILE related to the PHP path, for example, the program root directory is in: E: \ wamp \ www.
1. _ FILE _ absolute path of the current FILE
If you call index. php, E: \ wamp \ www \ index. php is returned.
Next, let's look at the directory structure of the program root directory.
If _ FILE _ is called in c_system_base.php, return:
E: \ wamp \ www \ zb_system \ function \ c_system_base.php
2. dirname: returns the parent directory of the current directory or the Directory of the current file (excluding/at the end /)
Generally used in combination with _ FILE _
If you call dirname (_ FILE _) in c_system_base.php
E: \ wamp \ www \ zb_system \ function (directory where the file is returned)
If dirname (_ FILE _) is called
E: \ wamp \ www \ zb_system (the directory returns the parent directory)
The realpath () method returns the absolute path of the current file or the path relative to the root directory.
If you call realpath (_ FILE _) in c_system_base.php
E: \ wamp \ www \ zb_system \ function \ c_system_base.php
Realpath ('/') returns the disk root directory E :\
Realpath ('./') returns the root directory E: \ wamp \ www
Realpath ('../') returns the parent directory of the corresponding program root directory
It can also be used with dirname. generally, several relative paths will be added./(you need to add/before :/../)
Realpath (dirname (_ FILE _) returns E: \ wamp \ www \ zb_system \ function
Realpath (dirname (_ FILE _). '/../') returns E: \ wamp \ www \ zb_system
Realpath (dirname (_ FILE _). '/.../../') returns E: \ wamp \ www