SplFileInfo::getType

(PHP 5 >= 5.1.2, PHP 7, PHP 8)

SplFileInfo::getTypeGets file type

Descrição

public SplFileInfo::getType ( ) : string

Returns the type of the file referenced.

Parâmetros

Esta função não possui parâmetros.

Valor Retornado

A string representing the type of the entry. May be one of file, link, dir, block, fifo, char, socket, or unknown

Erros

Throws a RuntimeException on error.

Exemplos

Exemplo #1 SplFileInfo::getType() example

<?php

$info 
= new SplFileInfo(__FILE__);
echo 
$info->getType().PHP_EOL;

$info = new SplFileInfo(dirname(__FILE__));
echo 
$info->getType();

?>

O exemplo acima irá imprimir algo similar à:

file
dir

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top