English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Filesystem Référence Manuel
La fonction pathinfo() peut retourner un tableau contenant des informations sur le chemin. Si des options sont spécifiées, elles retourneront les éléments spécifiés ; ils incluent : PATHINFO_DIRNAME, PATHINFO_BASENAME et PATHINFO_EXTENSION ou PATHINFO_FILENAME. Si les options ne sont pas spécifiées, le retour par défaut est l'ensemble des éléments.
mixed pathinfo ( string $path [, int $options = PATHINFO_DIRNAME | PATHINFO_BASENAME | PATHINFO_EXTENSION | PATHINFO_FILENAME ] )
Cette fonction pathinfo() peut retourner des informations sur le chemin : tableau associatif ou chaîne de caractères, selon les options.
<?php print_r(pathinfo("/PhpProject/simple.txt")); ?>
Résultat de la sortie
Array ( [dirname] => /PhpProject1 [basename] => simple.txt [extension] => txt [filename] => simple )
<?php print_r(pathinfo("/PhpProject/simple.txt, PATHINFO_BASENAME)); ?>
Résultat de la sortie
simple.txt