Current Location: Home> Function Categories> is_file

is_file

Determine whether the given file name is a normal file
Name:is_file
Category:File system
Programming Language:php
One-line Description:Determines whether the specified file is a regular file.

Definition and usage

is_file() function checks whether the specified file name is a normal file.

实例

例子 1

<?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

例子 2

<?php
var_dump(is_file('a_file.txt')) . "\n";
var_dump(is_file('/usr/bin/')) . "\n";
?>

输出:

bool(true)
bool(false)

grammar

 is_file ( file )
parameter describe
file Required. Specify documents to be inspected.

illustrate

Return true if the file exists and is a normal file.

Similar Functions
Popular Articles