SplFileInfo::getFilename

(PHP 5 >= 5.1.2, PHP 7)

SplFileInfo::getFilenameGets the filename

说锟斤拷

public SplFileInfo::getFilename ( void ) : string

Gets the filename without any path information.

锟斤拷锟斤拷

锟剿猴拷锟斤拷没锟叫诧拷锟斤拷锟斤拷

锟斤拷锟斤拷值

The filename.

锟斤拷锟斤拷

Example #1 SplFileInfo::getFilename() example

<?php
$info 
= new SplFileInfo('foo.txt');
var_dump($info->getFilename());

$info = new SplFileInfo('/path/to/foo.txt');
var_dump($info->getFilename());

$info = new SplFileInfo('http://www.php.net/');
var_dump($info->getFilename());

$info = new SplFileInfo('http://www.php.net/svn.php');
var_dump($info->getFilename());
?>

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

string(7) "foo.txt"
string(7) "foo.txt"
string(0) ""
string(7) "svn.php" 

锟轿硷拷