search
Homephp教程php手册PHP中is_dir()函数使用指南,is_dir使用指南

PHP中is_dir()函数使用指南,is_dir使用指南

函数:is_dir()

功能:判断给定文件名是否是一个目录

说明:
bool is_dir ( string $filename )

如果文件名存在并且为目录则返回 TRUE。
如果 filename 是一个相对路径,则按照当前工作目录检查其相对路径。

注: 本函数的结果会被缓存。更多信息参见 clearstatcache()。

例子1

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

上例将输出:

bool(false)
bool(false)
bool(true)

例子2

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

输出:
如果存在images这个目录,则输出:
images is a directory

以上所述就是本文的全部内容了,希望大家能够喜欢。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment