SplFileInfo::getType

SplFileInfo::getType

(PHP 5 >= 5.1.2, PHP 7)

SplFileInfo::getTypeGets file type

Description

public string SplFileInfo::getType ( void )

Returns the type of the file referenced.

Parameters

This function has no parameters.

Return Values

A string representing the type of the entry. May be one of file, link, or dir

Errors/Exceptions

Throws a RuntimeException on error.

Examples

Example #1 SplFileInfo::getType() example

<?php

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

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

?>

The above example will output something similar to:

file
dir

© 1997–2017 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://secure.php.net/manual/en/splfileinfo.gettype.php

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部