လက်ရှိတည်နေရာ: ပင်မစာမျက်နှာ> ဖန်ရှင်အမျိုးအစားများ> json_encode

json_encode

variable တွေကို JSON encoding
အမည်:json_encode
အမျိုးအစား:ဂျတ်ဆန်
programming language:php
တစ်ကြောင်းဖြင့်အကျဉ်းချုပ်:တန်ဖိုးကို JSON format နဲ့ encode ။

အဓိပ္ပါယ်နှင့်အသုံးပြုမှု

json_encode() function ကို JSON format နဲ့ encode လုပ်ဖို့အသုံးပြုသည်။

နမူနာ

ဥပမာ 1

jonson about တစ်ခုသို့ Associative Array တစ်ခုကို encode လုပ်နည်း။

 <? PHP
$ age = array ( "Bill" = >> 35 , "Elon" => 37 , "Steve" => 43 ) ;

echo json_entode ( $ အသက် ) ;
>

ဥပမာအားဖြင့် run ပါ

ဥပမာ 2

JSON Array သို့အညွှန်းကိန်းခင်းကျင်းမှုကိုဘယ်လို encode လုပ်နည်း။

 <? PHP
$ ကားများ = Array ( BMW " , " BMW " , " Toyota " ) ,

echo json_encode ( $ ကားများ ) ;
>

ဥပမာအားဖြင့် run ပါ

သဒ္ဒါ

 JSON_CENTODDODED ( တန်ဖိုး , options , အတိမ်အနက် )
တေးရေး ဖေါ်ပြ
အဘိုး လိုအပ်ပါတယ် encode ရန်တန်ဖိုးကိုသတ်မှတ်ပါတယ်။
ရွေးချယ်စရာများ optional ကို။ bitmmasks များကိုသတ်မှတ်ပါ (JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOC, JSON_INVALID_ATFECTOR, JSON_NSERVALID_CHECTOFE, JSON_NSERVARE_ATEC_Error JSON_PRETTY_PRING_LADE_LESMINATIONS, JSONSESSESSTED_SLASHES, JSONSESSESescaped_unicode, JSONSESSESSESTED_UNCUCED,
အနက် optional ကို။ အမြင့်ဆုံးအတိမ်အနက်ကိုသတ်မှတ်ပါ။
သက်ဆိုင်သောဖင်ခှ်ရှင်းများ
လူကြိုက်များသော ဆောင်းပါးများ