Is_dir () function user guide in PHP, is_dir User Guide _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Is_dir () function user guide in PHP and is_dir User Guide. In PHP, the is_dir () function User Guide. is_dir user guide function: is_dir () function: determines whether the given file name is a directory description: boolis_dir (string $ filename) if the file name is is_dir () in PHP () function User Guide, is_dir User Guide

Function: is_dir ()

Function: determines whether the specified file name is a directory.

Note:
Bool is_dir (string $ filename)

Returns TRUE if the file name exists and is a directory.
If filename is a relative path, check its relative path according to the current working directory.

Note: the result of this function is cached. For more information, see clearstatcache ().

Example 1

<?var_dump(is_dir('a_file.txt')) . "\n";var_dump(is_dir('bogus_dir/abc')) . "\n";var_dump(is_dir('..')); //one dir up?>

The above example will output:

Bool (false)
Bool (false)
Bool (true)

Example 2

<?php$file = "images";if(is_dir($file)){echo ("$file is a directory");}else{echo ("$file is not a directory");}?>

Output:
If the images directory exists, the output is:
Images is a directory

The above is all the content of this article. I hope you will like it.

Usage Guide of lift () function, is_dir usage guide function: is_dir () function: determines whether the given file name is a directory description: bool is_dir (string $ filename) if the file name...

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.