is_file() 是 PHP 中的一个内置函数,用于检查给定的文件路径是否存在并且确实是一个文件
<?php
$file_path = 'path/to/your/file.txt';
if (is_file($file_path)) {
echo "The file '$file_path' exists and is a file.";
} else {
echo "The file '$file_path' does not exist or is not a file.";
}
?>
在这个示例中,将 $file_path 替换为您要检查的文件路径。如果文件存在且是一个文件,is_file() 将返回 true,否则返回 false。

便宜VPS测评








