Fileinfo Funktionen
PHP Manual

finfo_file

finfo::file

(PHP >= 5.3.0, PECL fileinfo >= 0.1.0)

finfo_file -- finfo::fileGibt Informationen über eine Datei zurück

Beschreibung

Prozeduraler Stil

string finfo_file ( resource $finfo , string $file_name = NULL [, int $options = FILEINFO_NONE [, resource $context = NULL ]] )

Objektorientierter Stil

string finfo::file ( string $file_name = NULL [, int $options = FILEINFO_NONE [, resource $context = NULL ]] )

Diese Funktion wird benutzt, um Informationen über eine Datei zu erhalten.

Parameter-Liste

finfo

Fileinfo resource von finfo_open().

file_name

Name der Datei

options

Eine oder eine Trennung von mehreren Fileinfo Konstanten.

context

Für die Beschreibung des context-Parameters konsultieren Sie bitte das Kapitel Stream Funktionen des Manuals.

Rückgabewerte

Gibt eine textliche Beschreibung des Inhalts von filename oder FALSE falls ein Fehler auftritt.

Beispiele

Beispiel #1 Ein finfo_file() Beispiel

<?php
$finfo 
finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
foreach (glob("*") as $filename) {
    echo 
finfo_file($finfo$filename) . "\n";
}
finfo_close($finfo);
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

text/html
image/gif
application/vnd.ms-excel

Siehe auch


Fileinfo Funktionen
PHP Manual