PHP realpath path function will detect whether the target file (or folder) pointed to by $path actually exists, which is equivalent to calling file_exists($path).
If the target file exists and is not a symbolic link (called "shortcut" in Windows), the absolute path name of the file is returned and does not contain '/./' or '/../'.
If the target file is a symbolic link or does not exist, realpath() returns FALSE.
var_dump( realpath('./test.php') );
//If the test.php file can be found in the ./ path, the output result will be:
string 'E:DropboxMy Dropboxcodephptest.php' (length=48)
//If test.php is found under the ./ path and is a symbolic link, the output result is:
boolean false
//If the test.php file cannot be found under the ./ path, the output result is:
boolean false
//If it is executed under the Windows platform , the execution result of the following code is the same as above, because in Windows, both slash (/) and backslash () can be used as directory separators.
var_dump( realpath('.test.php') );
I hope the knowledge about the PHP realpath path function introduced above can be helpful to everyone.