TUTORIALBackendFETCHED

PHP file_exists() 函数

PHP file_exists() 函数 完整的 PHP Filesystem 参考手册 定义和用法 file_exists() 函数检查文件或目录是否存在。 如果指定的文件或目录存在则返回 TRUE,否则返回 FALSE。 语法 file_exists(path) 参数 描述 path 必需。规定要检查的路径。 实例 <?php echo file_exist..

Updated 7/16/2026

Tutorial detail pages default to noindex.

PHP file_exists() 函数


PHP Filesystem 参考手册 完整的 PHP Filesystem 参考手册

定义和用法

file_exists() 函数检查文件或目录是否存在。

如果指定的文件或目录存在则返回 TRUE,否则返回 FALSE。

语法

file_exists(path)

参数 描述
path 必需。规定要检查的路径。


实例

<?php
echo file_exists("test.txt");
?>

上面的代码将输出:

1


PHP Filesystem 参考手册 完整的 PHP Filesystem 参考手册