PHP 8.1.28 Released!

SplFileInfo::getType

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

SplFileInfo::getTypeGets file type

Descrizione

public SplFileInfo::getType(): string|false

Returns the type of the file referenced.

Elenco dei parametri

Questa funzione non contiene parametri.

Valori restituiti

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

Errori/Eccezioni

Throws a RuntimeException on error.

Esempi

Example #1 SplFileInfo::getType() example

<?php

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

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

?>

Il precedente esempio visualizzerà qualcosa simile a:

file
dir

add a note

User Contributed Notes

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