无涯教程-File文件 - file_exists()函数

71 阅读1分钟

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</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> echo </span><span class="str">"The file file_open exists"; }else { echo "The file $file_open does not exist"; } ?>

参考链接

www.learnfk.com/php/php-fun…