is_writable() फ़ंक्शन जांचता है कि कोई फ़ाइल लिखने योग्य है या नहीं। यदि फ़ाइल मौजूद है और लिखने योग्य है तो यह TRUE लौटाता है।
सिंटैक्स
is_writable(file_path)
पैरामीटर
-
file_path - जाँच की जाने वाली फ़ाइल का पथ।
वापसी
यदि फ़ाइल मौजूद है और लिखने योग्य है, तो is_writable() फ़ंक्शन TRUE लौटाता है।
उदाहरण
<?php
$file = "one.txt";
if(is_writable($file)) {
echo ("File is writeable!");
} else {
echo ("File is not writeable!");
}
?> आउटपुट
File is not writeable!
आइए एक और उदाहरण देखें।
उदाहरण
<?php
$file_permissions = fileperms("two.txt");
$res = sprintf("%o", $file_permissions);
$file = "two.txt";
if(is_writable($file)) {
echo ("File is writeable!");
echo(“Permission = $res”);
} else {
echo ("File is not writeable!");
echo(“Permission = $res”);
}
?> आउटपुट
File is writeable! Permission: 0777