English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Tutorial Básico PHP

Tutorial Avançado PHP

PHP & MySQL

Manual de Referência PHP

Uso e exemplo da função PHP is_writable()

PHP Filesystem Referência Manual

A função is_writable() pode verificar se o arquivo especificado é gravável. Se o arquivo for gravável, esta função pode retornar true.

Sintaxe

bool is_writable ( string $filename )

Se o nome do arquivo existir e for gravável, esta função pode retornar true. O parâmetro filename pode ser um nome de diretório, o que nos permite verificar se o diretório é gravável também.

Exemplo online

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

Resultado de saída

/PhpProject/php/phptest.txt é gravável
PHP Filesystem Referência Manual