PHP headers_list() လုပ်ဆောင်ချက်
ဥပမာ
ပေးပို့ထားသော တုံ့ပြန်မှု ခေါင်းစီးစာရင်းကို ပြန်ပေးပါ။
<?php
setcookie("TestCookie","SomeValue");
header("X-Sample-Test: foo");
header("Content-type: text/plain");
?>
<html>
<body>
<?php
var_dump(headers_list());
?>
</body>
</html>
အထက်ဖော်ပြပါ ကုဒ်၏ ရလဒ်သည်-
array(4)
{
[0]=> string(23) "X-Powered-By: PHP/7.1.1"
[1]=> string(19) "Set-Cookie: TestCookie=SomeValue"
[2]=> string(18) "X-Sample-Test: foo"
[3]=> string(24) "Content-type: text/plain"
}
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
headers_list() လုပ်ဆောင်ချက်သည် ဘရောက်ဆာသို့ ပေးပို့ရမည့် တုံ့ပြန်မှု ခေါင်းစီးစာရင်းကို ပြန်ပေးသည်။
အကြံပြုချက်- ခေါင်းစီးများကို ပေးပို့ခြင်း ရှိ၊ မရှိ ဆုံးဖြတ်ရန်၊ headers_sent() လုပ်ဆောင်ချက်ကို အသုံးပြုပါ။
အထားအသို
headers_list()
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | အောင်မြင်မှုအပေါ် ကိန်းဂဏန်းအညွှန်းကိန်းများ ခင်းကျင်းထားသည်။ |
---|---|
PHP ဗားရှင်း- | 5.0+ |
❮ PHP Network ရည်ညွှန်းချက်