CakeFest 2024: The Official CakePHP Conference

SplFileInfo::getType

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

SplFileInfo::getTypeGets file type

Beschreibung

public SplFileInfo::getType(): string|false

Returns the type of the file referenced.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

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.

Fehler/Exceptions

Throws a RuntimeException on error.

Beispiele

Beispiel #1 SplFileInfo::getType() example

<?php

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

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

?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

file
dir

add a note

User Contributed Notes

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