pathinfo

(PHP 4 >= 4.0.3, PHP 5)

pathinfo -- ファイルパスに関する情報を返す

説明

array pathinfo ( string path)

pathinfo() は、path に 関する情報を有する連想配列を返します。次の配列要素が返されます。 dirname, basename, extension

例 1. pathinfo()の例

<?php

$path_parts
= pathinfo("/www/htdocs/index.html");

echo
$path_parts["dirname"] . "\n";
echo
$path_parts["basename"] . "\n";
echo
$path_parts["extension"] . "\n";

?>

出力は次のようになります。

/www/htdocs
index.html
html

注意: For information on retrieving the current path info, read the section on predefined reserved variables. カレントのパスに関する情報を取得するには、 定義済みの変数 のセクションをご覧ください。

dirname(), basename(), parse_url(), realpath()も参 照下さい。