Home>Article>Backend Development> How to check if a folder exists in php
In php, you can use the file_exists() function to check whether a folder exists, the syntax is "file_exists (folder path)"; if the return value is "true", the folder exists, if the return value is "false" means the folder does not exist.
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
In php, you can use file_exists () function to check whether a folder exists.
The file_exists() function checks whether a file or directory (folder) exists. Returns true if the specified file or directory exists, false otherwise.
Syntax:
file_exists(path)
path: required. Specifies the path to be checked.
Example: Check if the img folder exists:
## Recommended study:《PHP video tutorial》
The above is the detailed content of How to check if a folder exists in php. For more information, please follow other related articles on the PHP Chinese website!