is_file
Determine whether the given file name is a normal file
is_file() function checks whether the specified file name is a normal file.
<?php
$file = "test.txt";
if(is_file($file))
{
echo ("$file is a regular file");
}
else
{
echo ("$file is not a regular file");
}
?>
输出:
test.txt is a regular file
<?php
var_dump(is_file('a_file.txt')) . "\n";
var_dump(is_file('/usr/bin/')) . "\n";
?>
输出:
bool(true) bool(false)
is_file ( file )
| parameter | describe |
|---|---|
| file | Required. Specify documents to be inspected. |
Return true if the file exists and is a normal file.