File文件 中的 file_exists()函数

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

file_exists() - 语法

bool file_exists ( string $file_open );

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

file_open   -  文件或目录的路径。

file_exists() - 返回值

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

无涯教程网

链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-file-exists.html

来源:LearnFk无涯教程网

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";
   }
?>

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

技术教程推荐

微服务架构核心20讲 -〔杨波〕

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

程序员的数学基础课 -〔黄申〕

Vue开发实战 -〔唐金州〕

后端存储实战课 -〔李玥〕

软件设计之美 -〔郑晔〕

用户体验设计实战课 -〔相辉〕

成为AI产品经理 -〔刘海丰〕

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

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