File_exists-Check whether a file or directory exists _php tutorial

Source: Internet
Author: User
File_exists-Check whether a file or directory exists

File_exists
(PHP 4, PHP 5)

File_exists-Check whether a file or directory exists

Describe
Boolean file_exists (string $ file name)
Check to see if a file or directory exists.

Parameters

Filename
Path to a file or directory.

In Windows, use the//Computer name/share/file name or computer name to share the file name to check for files on the network share.


return value
Returns true if the filename of the specified file or directory exists; Except for false.

Note: This feature returns false for a symbolic link to a file that does not exist.


Warning
This feature returns false files because of the inability to enter Safe mode restrictions. But these files can also contain if they are located in Safe_mode_include_dir.

Note: The check is not valid using the real uid/gid.


Instance

For example # 1 Test if the file exists

$filename = '/path/to/foo.txt ';

if (file_exists ($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}
?>


http://www.bkjia.com/PHPjc/445479.html www.bkjia.com true http://www.bkjia.com/PHPjc/445479.html techarticle file_exists-Check whether a file or directory exists file_exists (PHP 4, PHP 5) file_exists-Check whether a file or directory exists that describes Boolean file_exists (string $ file name) ...

  • Related Article

    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.