PHP file_get_contents() လုပ်ဆောင်ချက်
❮ PHP ဖိုင်စနစ် အကိုးအကားဥပမာ
ဖိုင်ကို စာကြောင်းတစ်ခုသို့ ဖတ်ပါ-
<?php
echo file_get_contents("test.txt");
?>
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
file_get_contents() သည် ဖိုင်တစ်ခုကို စာကြောင်းတစ်ခုသို့ ဖတ်သည်။
ဤလုပ်ဆောင်ချက်သည် စာကြောင်းတစ်ခုသို့ ဖိုင်တစ်ခု၏ အကြောင်းအရာများကို ဖတ်ရန် ဦးစားပေးနည်းလမ်းဖြစ်သည်။ ၎င်းကို ဆာဗာမှ ပံ့ပိုးပေးမည်ဆိုပါက ၎င်းသည် စွမ်းဆောင်ရည်မြှင့်တင်ရန် မန်မိုရီမြေပုံနည်းပညာများကို အသုံးပြုမည်ဖြစ်သည်။
အထားအသို
file_get_contents(path, include_path, context, start,
max_length)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
path | Required. Specifies the path to the file to read |
include_path | Optional. Set this parameter to '1' if you want to search for the file in the include_path (in php.ini) as well |
context | Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream. Can be skipped by using NULL. |
start | Optional. Specifies where in the file to start reading. Negative values count from the end of the file |
max_length | Optional. Specifies the maximum length of data read. Default is read to EOF |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | စာကြောင်းတစ်ခုရှိ ဖိုင်တစ်ခုလုံး၊ ပျက်ကွက်မှုတွင် FALSE |
---|---|
PHP ဗားရှင်း- | 4.3+ |
Binary Safe- | ဟုတ်ပါတယ်၊ PHP 4.3 မှာ |
PHP Changelog- | PHP 7.1 - start parameter PHP 5.1 ရှိ အနုတ်တန်ဖိုးများအတွက် ပံ့ပိုးမှု - start နှင့် max_length ဘောင် များကို ပေါင်းထည့်သည် |
❮ PHP ဖိုင်စနစ် အကိုးအကား