File::stripTrailingSeparators()

File::stripTrailingSeparators() – パスから最後のセパレータを取り除く

Synopsis

require_once 'File.php';

string File:stripTrailingSeparators ( string $path , string $separator = = DIRECTORY_SEPARATOR )

Description

このメソッドは、パス名から最後のセパレータ (*nixでは "/" のような) を取り除きます。

Parameter

  • string $path - 最後のセパレータを取り除くパス名を指定します。

  • string $separator - セパレータを定義するオプション文字列を指定します。 このパラメータのデフォルト値は、PHP であらかじめ定義されている DIRECTORY_SEPARATOR 定数の値です。

Return value

このメソッドは、 最後のディレクトリセパレータが取り除かれたパス名を返します。

Note

This function can be called statically.

Example

File:stripTrailingSeparators() の例

<?php
require_once "File.php";

echo 
File::stripTrailingSeparators("/home/foo/lala/");
?>

この例は、/home/foo/lala を表示します。