File_exists-check whether the file or directory exists

Source: Internet
Author: User

File_exists
(PHP 4 and PHP 5)



Description
Boolean file_exists (string $ file name)
Check whether a file or directory exists.

Parameters

File name
Path.

In Windows, use // Computer Name/shared/file name or computer name shared file name to check files on network sharing.


Return value
Returns TRUE if the specified file or directory file name exists, except FALSE.

Note: This function will return a FALSE symbolic link pointing to a non-existent file.


Warning
This function returns FALSE files because it is unable to enter the security mode. But these files can also contain if they are located in safe_mode_include_dir.

Note: The check results use real UID/GID and are not valid.


Instance

For example, if the #1 test file exists

<? Php
$ Filename = '/path/to/foo.txt ';

If (file_exists ($ filename )){
Echo "The file $ filename exists ";
} Else {
Echo "The file $ filename does not exist ";
}
?>

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.