PHP is_readable() 函数用法及示例 - PHP教程

由网友 大卫 发布 阅读 2

PHP is_readable() 函数用法及示例 - PHP教程

PHP Filesystem 参考手册

is_readable()函数可以检查指定的文件是否可读。如果文件可读,则此函数返回true。

语法

bool is_readable ( string $filename )

此函数可以判断文件是否存在并且可读。

在线示例

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

输出结果

/PhpProject/php/phptest.txt is readable

PHP Filesystem 参考手册

PHP readfile() PHP is_writeable()