English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Filesystem Référence Manuel
La fonction is_file() peut vérifier si le fichier spécifié est un fichier normal.
bool is_file ( string $filename )
Si le nom de fichier existe et est un fichier normal, cette fonction peut retourner true, sinon retourner false.
<?php $file = "/PhpProject/php/phptest.txt"; if(is_file($file)) { echo("$file est un fichier normal"); } else { echo("$file n'est pas un fichier normal"); } ?>
Résultat de la sortie
/PhpProject/php/phptest.txt est un fichier normal
<?php var_dump(is_file("/PhpProject/simple.txt")) . "\n"; var_dump(is_file("/PhpProject/php")) . "\n"; ?>
Résultat de la sortie
bool(false) bool(false)