开发者

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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜