Differences between is_file and file_exist in php _ PHP Tutorial

Source: Internet
Author: User
Differences between is_file and file_exist in php. In PHP, is_file and file_isexist have many cells. 1) is_file: export pathtofiletext.txt; if (file_exists ($ path) echoFileExists; elseechoFilenotExists; for example, in PHP, is_file and file_isexist have very small cells.
1) is_file:
$ Path = "/path/to/file/text.txt ";
If (file_exists ($ path ))
Echo "File Exists ";
Else
Echo "File not Exists ";
For example, in this example, if a file exists, true is returned, and false is returned if no object exists.
The correct path (such as a file directory) also returns true:
$ Path = "/path/to/file ";

2) file_isexist ()
This won't happen. it is really to judge whether a file exists. if the above one is passed in, although it looks like
The correct path also returns false.

Author: jackyrong"

Upload 1) is_file: $ path =/path/to/file/text.txt; if (file_exists ($ path) echo File Exists; else echo File not Exists; for example...

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.