SplFileInfo::isFile

(PHP 5 >= 5.1.2, PHP 7)

SplFileInfo::isFileTells if the object references a regular file

说锟斤拷

public SplFileInfo::isFile ( void ) : bool

Checks if the file referenced by this SplFileInfo object exists and is a regular file.

锟斤拷锟斤拷

锟剿猴拷锟斤拷没锟叫诧拷锟斤拷锟斤拷

锟斤拷锟斤拷值

Returns TRUE if the file exists and is a regular file (not a link), FALSE otherwise.

锟斤拷锟斤拷

Example #1 SplFileInfo::isFile() example

<?php
$info 
= new SplFileInfo(__FILE__);
var_dump($info->isFile());

$info = new SplFileInfo(dirname(__FILE__));
var_dump($info->isFile());
?>

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

bool(true)
bool(false)