PHP: Vérifier si un élément est un répertoire

<html>
<head>
<title>Is the file a directory: is_dir()</title>
</head>
<body>
<?php
$file = "test.txt";
outputFileTestInfo( $file );
function outputFileTestInfo( $f ){
   if ( ! file_exists( $f ) ){
       print "$f does not exist<BR>";
      return;
   }
   print "$f is ".(is_dir( $f )?"":"not ")."a directory<br>";
}
?>
</body>
</html>
           
       
<html>
<head>
<title>Is the file a directory: is_dir()</title>
</head>
<body>
<?php
$file = "test.txt";
outputFileTestInfo( $file );
function outputFileTestInfo( $f ){
   if ( ! file_exists( $f ) ){
       print "$f n'existe pas<BR>";
      return;
   }
   print "$f ".(is_dir( $f )?"est ":"n'est ")."pas un répertoire<br>";
}
?>
</body>
</html>
 
           
       

No Comments

  • Your comment is awaiting moderation

    The worth a chunk of achieves at public sale is normally lower than the retail value particularly as antiques are continuously bought by sellers for resale.

    Check out my web page … Joma Jewellery Sale (Gabriela)

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>