PHP - Fonction is_readable ()

La fonction is_readable () peut vérifier si le fichier spécifié est lisible. Cette fonction peut renvoyer true si le fichier est lisible.

Syntaxe

bool is_readable ( string $filename )

Cette fonction peut dire si un fichier existe et est lisible.

Exemple

<?php
  $file = "/PhpProject/php/phptest.txt";
   if(is_readable($file)) {
      echo ("$file is readable");
   } else {
      echo ("$file is not readable");
   }
?>

Production

/PhpProject/php/phptest.txt is readable