Home >Backend Development >PHP Problem >How to use the is_readable function in php

How to use the is_readable function in php

藏色散人
藏色散人Original
2019-05-24 17:26:372627browse

Usage of is_readable function in php: [is_readable(file)]. The is_readable function is used to determine whether the specified file is readable. If the specified file or directory exists and is readable, the function returns true, otherwise, the function returns false.

How to use the is_readable function in php

php is_readable function is used to determine whether the specified file is readable. Its syntax is is_readable(file). The parameter file is required and refers to the file to be checked. .

(Recommended tutorial: php video tutorial)

How to use the php is_readable function?

Function: Determine whether the specified file is Readable.

Syntax:

is_readable(file)

Parameters:

file required. Specifies the documents to be checked.

Explanation:

Returns TRUE if the file or directory specified by file exists and is readable.

php is_readable() function example

<?php
$file = is_readable("./test.txt");
if($file == 1)
{
    echo "该文件是可读的";
}else{
    echo "该文件不可读";
}
?>

The above is the detailed content of How to use the is_readable function in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn