PHP/File Directory/is link — различия между версиями

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

Версия 10:37, 26 мая 2010

Using the File-System Logic Functions

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