phpday 2027 - Call for Papers

SplFileInfo::getPath

(PHP 5 >= 5.1.2, PHP 7, PHP 8)

SplFileInfo::getPath — Le chemin sans le nom de fichier

Description

public function SplFileInfo::getPath(): string

Retourne le nom du chemin sans le nom de fichier, ou un slash final.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

Retourne le chemin du fichier.

Exemples

Exemple #1 Exemple avec SplFileInfo::getPath()

<?php
$info = new SplFileInfo('/usr/bin/php');
var_dump($info->getPath());


$info = new SplFileInfo('/usr/');
var_dump($info->getPath());?>

Résultat de l'exemple ci-dessus est similaire à :

string(8) "/usr/bin"
string(4) "/usr"

Voir aussi

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top