Manuel PHP

SplFileInfo::getFilename

(PHP 5 >= 5.1.2)

SplFileInfo::getFilenameGets the filename

Description

public string SplFileInfo::getFilename ( void )

Gets the filename without any path information.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

The filename.

Exemples

Exemple #1 SplFileInfo::getFilename() example

  1. <?php
  2. $info = new SplFileInfo('foo.txt');  
  3. var_dump($info->getFilename());  
  4.  
  5. $info = new SplFileInfo('/path/to/foo.txt');  
  6. var_dump($info->getFilename());  
  7.  
  8. $info = new SplFileInfo('http://www.php.net/');  
  9. var_dump($info->getFilename());  
  10.  
  11. $info = new SplFileInfo('http://www.php.net/anoncvs.php');  
  12. var_dump($info->getFilename());  
  13. ?> 

L'exemple ci-dessus va afficher quelque chose de similaire à :

string(7) "foo.txt" string(7) "foo.txt" string(0) "" string(11) "anoncvs.php"


Remonter Remonter
L'éditeur javascript - CSS - Gentoo - Tutoriaux PHP - Tutoriels PHP - Bretagne - php - Moto - Kit graphique