PHP determines whether a file or directory exists
1. file_exists() function
Judgement Whether the file exists
Example:
//$file = "check.txt"; if(file_exists($file)) { echo "当前目录中,文件".$file."存在"; } else { echo "当前目录中,文件".$file."不存在"; }
2. is_dir() function
Determine whether the directory exists
Example:
//$dir = "c:/datacheck"; if(is_dir($dir)) { echo "当前目录下,目录".$dir."存在"; } else { echo "当前目录下,目录".$dir."不存在"; }
Recommended tutorial: PHP video tutorial
The above is the detailed content of php determines whether a folder exists. For more information, please follow other related articles on the PHP Chinese website!

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

SublimeText3 Linux new version
SublimeText3 Linux latest version

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

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
