PHP fread() လုပ်ဆောင်ချက်
❮ PHP ဖိုင်စနစ် အကိုးအကားဥပမာ
အဖွင့်ဖိုင်တစ်ခုမှ 10 bytes ကိုဖတ်ပါ။
<?php
$file = fopen("test.txt","r");
fread($file,"10");
fclose($file);
?>
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
fread() သည် အဖွင့်ဖိုင်မှ ဖတ်သည်။
လုပ်ဆောင်ချက်သည် ဖိုင်၏အဆုံးတွင် သို့မဟုတ် သတ်မှတ်ထားသော အရှည်သို့ရောက်သောအခါ၊ မည်သည်က အရင်ရောက်သည်ဖြစ်စေ ရပ်တန့်သွားမည်ဖြစ်သည်။
အထားအသို
fread(file, length)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
file | Required. Specifies the open file to read from |
length | Required. Specifies the maximum number of bytes to read |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | ဖတ်ပြီးသော စာကြောင်း ၊ FALSE သည် မအောင်မြင်ပါ။ |
---|---|
PHP ဗားရှင်း- | 4.0+ |
Binary Safe- | ဟုတ်ကဲ့ |
နောက်ထပ် ဥပမာများ
ဥပမာ
ဖိုင်တစ်ခုလုံးကို ဖတ်ရန်-
<?php
$file = fopen("test.txt","r");
fread($file,filesize("test.txt"));
fclose($file);
?>
❮ PHP ဖိုင်စနစ် အကိုးအကား