SplFileInfo::isDir

(PHP 5 >= 5.1.2, PHP 7)

SplFileInfo::isDirTells if the file is a directory

说锟斤拷

public SplFileInfo::isDir ( void ) : bool

This method can be used to determine if the file is a directory.

锟斤拷锟斤拷

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

锟斤拷锟斤拷值

Returns TRUE if a directory, FALSE otherwise.

锟斤拷锟斤拷

Example #1 SplFileInfo::isDir() example

<?php
$d 
= new SplFileInfo(dirname(__FILE__));
var_dump($d->isDir());

$d = new SplFileInfo(__FILE__);
var_dump($d->isDir());
?>

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

bool(true)
bool(false)