The PHP realpath path function detects if the target file (or folder) the $path points to is real, equivalent to calling the File_exists ($path).
1, if the target file exists and is not a symbolic connection (commonly known as "soft link" under Linux, Windows is called "Shortcut"), then the absolute path name of the file is returned (does not contain '/./' or '/. /’。 )
2. Realpath () returns False if the destination file does not exist .
3. Realpath () returns False if the destination file is a symbolic connection .
Such as:
Var_dump (Realpath ('./test.php')); // if the test.php file (that is, exists) can be found under the./path, the output is: string ' E:\Dropbox\My dropbox\code\php\test.php ' (length=) // If the test.php is a symbolic connection found under the./path, the output is: false// If the test.php file cannot be found under the./path, the output is:false
If executed under the Windows platform, the downstream code executes as follows, because in Windows, the slash (/) and the backslash (\) can be used as directory separators.
Var_dump (Realpath ('. \test.php '));
PHP--Realpath ($path) function