downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SplFileInfo::getCTime> <SplFileInfo::getATime
Last updated: Fri, 13 Nov 2009

view this page in

SplFileInfo::getBasename

(PHP 5 >= 5.2.2)

SplFileInfo::getBasenameファイルのベース名を取得する

説明

public string SplFileInfo::getBasename ([ string $suffix ] )

このメソッドは、ファイルやディレクトリそしてリンクからパス情報を除いたベース名を返します。

パラメータ

suffix

返されるベース名から取り除きたい、オプションのサフィックス。

返り値

パス情報を含まないベース名を返します。

例1 SplFileInfo::getBasename() の例

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

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

$info = new SplFileInfo('/path/to/file.txt');
var_dump($info->getbaseName('.txt'));
?>

上の例の出力は、 たとえば以下のようになります。

string(8) "file.txt"
string(8) "file.txt"
string(4) "file" 

参考



add a note add a note User Contributed Notes
SplFileInfo::getBasename
There are no user contributed notes for this page.

SplFileInfo::getCTime> <SplFileInfo::getATime
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites