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

参考链接

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