PHP ftruncate() လုပ်ဆောင်ချက်
❮ PHP ဖိုင်စနစ် အကိုးအကားဥပမာ
အဖွင့်ဖိုင်ကို သတ်မှတ်ထားသော အရှည် (100 bytes) သို့ ဖြတ်တောက်သည်-
<?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 |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | အောင်မြင်မှုအပေါ် မှန်ကန်သည် သို့မဟုတ် ကျရှုံးမှုတွင် မှားသည်။ |
---|---|
PHP ဗားရှင်း- | 4.0+ |
❮ PHP ဖိုင်စနစ် အကိုးအကား