PHP--Realpath ($path) function

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.