php提供内置函数is_dir来检查传入的路径参数是否为目录,如果是目录则返回true。也就是说传入的参数是文件或者不存在都为false,因此当前参数不能说不是文件夹就
函数:is_dir()
功能:判断给定文件名是否是一个目录
说明:
bool is_dir ( string $filename )
如果文件名存在并且为目录则返回 TRUE。
如果 filename 是一个相对路径,则按照当前工作目录检查其相对路径。
注: 本函数的结果会被缓存。更多信息参见 clearstatcache()。
例子1
上例将输出:
bool(false)
bool(false)
bool(true)
例子2
输出:
如果存在images这个目录,,则输出:
images is a directory
以上所述就是本文的全部内容了,希望大家能够喜欢。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver CS6
Visual web development tools