php determines whether directory exists
Sep 25, 2019 pm 05:55 PMPHP determines whether a file or directory exists
file_exists: determines whether a file exists
$file = "check.txt"; if(file_exists($file)) { echo "当前目录中,文件".$file."存在"; } else { echo "当前目录中,文件".$file."不存在"; }
is_dir: Determine whether the directory exists
$dir = "c:/datacheck"; if(is_dir($dir)) { echo "当前目录下,目录".$dir."存在"; } else { echo "当前目录下,目录".$dir."不存在"; }
Note: The result of this function will be cached. Please use clearstatcache() to clear the cache.
Recommended tutorial: PHP video tutorial
The above is the detailed content of php determines whether directory exists. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

How To Set Up Visual Studio Code (VS Code) for PHP Development
