PHP/File Directory/is link

Материал из Web эксперт
Перейти к: навигация, поиск

Using the File-System Logic Functions

   <source lang="html4strict">

<?php

    $testfile = "data.txt";
    if(!file_exists($testfile)) {
         echo "Error -- $testfile doesn"t exist!
"; exit; } echo "What we know about the file $testfile
"; if(is_dir($testfile)) echo "It is a directory.
"; if(is_file($testfile)) echo "It is an actual file (not symbolic link)
"; if(is_link($testfile)) echo "It is a symbolic link to a real file
"; if(is_uploaded_file($testfile)) echo "It is an uploaded file
"; if(is_readable($testfile)) echo "The file is readable by PHP
"; if(is_writeable($testfile)) echo "The file is writeable by PHP
"; if(is_executable($testfile)) echo "The file is executable by PHP
";

?>

 </source>