Error handling opendir
I always get a warming when I tried to use the opendir() but the folder does not exists. How can I handle this error, and verify if the folder exi开发者_开发知识库sts before open the directory?
is_dir($directory)
Returns TRUE if the filename exists and is a directory, FALSE otherwise.
You can check if the directory exists with is_dir()
if(is_dir($dir)){
// code
}
精彩评论