search
Homephp教程php手册php判断文件或目录(文件夹)是否存在

php判断文件或目录(文件夹)是否存在

 php库自带有判断文件或目录是否存在的函数,file_exists判断文件是否存在,is_dir判断目录(文件夹)是否存在。具体示例如下:

$file='index.php';
$dir='www.phpernote.com/wwwroot/';
if(file_exists($dir.$file)){
	echo '文件'.$file.'存在';
}else{
	echo '文件'.$file.'不存在';
}
if(is_dir($dir)){
    echo '目录'.$dir.'存在';
}else{
    echo '目录'.$dir.'不存在';
}

您可能感兴趣的文章

  • php清空(删除)指定目录下的文件,不删除目录文件夹的方法
  • php获取目录所有文件并将结果保存到数组的程序
  • php判断远程文件是否存在的办法
  • linux chmod(文件或文件夹权限设定)命令参数及用法详解
  • php判断函数,类,类方法是否存在
  • linux删除文件,文件夹命令rm 命令详解
  • PHP判断上传文件类型最安全,最真实的解决办法
  • php判断字符串是否全英文,纯中文,中英文组合的方法
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software