File文件 中的 file_exists()函数

首页 / PHP入门教程 / File文件 中的 file_exists()函数

file_exists() - 语法

bool file_exists ( string $file_open );

检查文件或目录是否存在。

file_open   -  文件或目录的路径。

file_exists() - 返回值

如果file_open指定的文件或目录存在,则返回true;否则返回false。

file_exists() - 示例

<?php
   $file_open='/home/httpd/index.htm';
   
   if (file_exists($file_open)) {
      echo "The file $file_open exists";
   }else {
      echo "The file $file_open does not exist";
   }
?>

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

从0开始学架构 -〔李运华〕

重学前端 -〔程劭非(winter)〕

Spring Boot与Kubernetes云原生微服务实践 -〔杨波〕

To B市场品牌实战课 -〔曹林〕

人人都用得上的写作课 -〔涵柏〕

全链路压测实战30讲 -〔高楼〕

运维监控系统实战笔记 -〔秦晓辉〕

结构思考力 · 透过结构看表达 -〔李忠秋〕

徐昊 · AI 时代的软件工程 -〔徐昊〕

好记忆不如烂笔头。留下您的足迹吧 :)