पीएचपी ftruncate () समारोह
❮ पीएचपी फाइल सिस्टम संदर्भउदाहरण
एक खुली फ़ाइल को निर्दिष्ट लंबाई (100 बाइट्स) तक छोटा करता है:
<?php
// Check filesize
echo filesize("test.txt");
echo "<br>";
$file = fopen("test.txt", "a+");
ftruncate($file,100);
fclose($file);
// Clear cache and check filesize again
clearstatcache();
echo filesize("test.txt");
?>
उपरोक्त कोड का आउटपुट होगा:
792
100
परिभाषा और उपयोग
ftruncate() फ़ंक्शन एक खुली फ़ाइल को निर्दिष्ट लंबाई तक छोटा करता है।
वाक्य - विन्यास
ftruncate(file, size)
पैरामीटर मान
Parameter | Description |
---|---|
file | Required. Specifies the open file to truncate |
size | Required. Specifies the new file size |
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | सफलता पर सत्य, या असफलता पर असत्य। |
---|---|
पीएचपी संस्करण: | 4.0+ |
❮ पीएचपी फाइल सिस्टम संदर्भ