PHP推断文件或目次是不是存在
1、file_exists()函数
推断文件文件是不是存在
实例:
//$file = "check.txt"; if(file_exists($file)) { echo "当前目次中,文件".$file."存在"; } else { echo "当前目次中,文件".$file."不存在"; }
2、is_dir()函数
推断目次是不是存在
实例:
//$dir = "c:/datacheck"; if(is_dir($dir)) { echo "当前目次下,目次".$dir."存在"; } else { echo "当前目次下,目次".$dir."不存在"; }
引荐教程:PHP视频教程
以上就是php推断文件夹是不是存在的细致内容,更多请关注ki4网别的相干文章!