Home >Backend Development >PHP Tutorial >php is_writable Whether the function file can be written_PHP tutorial

php is_writable Whether the function file can be written_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:01:061106browse

The following is about whether the is_writable file can be read and written. ​

The following is about whether the is_writable file can be read and written.

is_writable
(PHP 4, PHP 5)

is_writable - tells whether filename is writable

Description
boolean is_writable (string $filename)
Returns TRUE if the file exists and is writable. The filename argument may be a directory name, allowing you to check if the directory is writable.

Keep in mind that PHP can access this file with the user ID of the web server running (usually 'who'). Safe mode restrictions are not taken into account.

Parameters

File name
The name of the file being checked.


Return value
Returns TRUE if the file exists and is writable.

Example

Example #1 is_writable() example

$filename = 'test.txt';
if (is_writable($filename)) {
echo 'The file is writable';
} else {
echo 'The file is not writable';
}
?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445468.htmlTechArticleThe following is about whether the is_writable file can be read and written. The following is about whether the is_writable file can be read and written. is_writable (PHP 4, PHP 5) is_writable - tells is...
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