Read the PHP realpath path function _php Tutorial

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).

If the destination file exists and is not a symbolic connection (called "Shortcut" in Windows), the absolute pathname of the file is returned and does not contain '/./' or '/'. /’。
If the destination file is a symbolic connection or does not exist, Realpath () returns false.

Var_dump (Realpath ('./test.php '));

If the test.php file can be found under the./path, the output is:

String ' E:dropboxmy dropboxcodephptest.php ' (length=48)

If the test.php is a symbolic connection found under the./path, the output is:

Boolean false

If the test.php file cannot be found under the./path, the output is:

Boolean false

If executed under the Windows platform, the downstream code executes as follows, because in Windows, the slash (/) and backslash () can be used as directory separators.

Var_dump (Realpath ('. test.php '));

I hope the above-mentioned PHP realpath path function knowledge can be helpful to everyone.


http://www.bkjia.com/PHPjc/446153.html www.bkjia.com true http://www.bkjia.com/PHPjc/446153.html techarticle 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). If the destination file exists and is not a symbolic connection ...

  • 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.