PHP determines whether a file or directory (folder) exists _php tutorial

Source: Internet
Author: User

PHP determines whether a file or directory (folder) exists


PHP Library has a function to determine whether a file or directory exists, file_exists determine whether the file exists, Is_dir determine whether the directory (folder) exists. Specific examples are as follows:

$file = ' index.php '; $dir = ' www.phpernote.com/wwwroot/'; if (file_exists ($dir. $file)) {echo ' file '. $file. ' Existence ';} Else{echo ' file '. $file. ' not present ';} if (Is_dir ($dir)) {    echo ' directory '. $dir. ' exist ';} else{    echo ' directory '. $dir. ' not present ';}

Articles you may be interested in

    • PHP Empty (delete) the file under the specified directory, do not delete the Directory folder method
    • PHP gets all the files in the directory and saves the results to an array of programs
    • PHP to determine if a remote file exists
    • Linux chmod (file or folder permission settings) command parameters and usage details
    • PHP judgment function, class, class method exists
    • Linux Delete files, Folder command RM command detailed
    • PHP determines the safest and most realistic solution for uploading file types
    • PHP to determine whether the string is in English, pure Chinese, the method of combination of English

http://www.bkjia.com/PHPjc/982049.html www.bkjia.com true http://www.bkjia.com/PHPjc/982049.html techarticle PHP to determine whether a file or directory (folder) exists in PHP Library from the judgment file or directory exists function, file_exists determine whether the file exists, Is_dir determine the directory (folder) is ...

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