我有一个字段格式:
{"2G Network":"GSM 850","3G Network":"HSDPA 850"}
如何以格式将数据放入数组中:
array(["2G Network"]=>"GSM 850", ["3G Network"]=>"HSDPA 850");
这个想法如何
我有一个字段格式:
{"2G Network":"GSM 850","3G Network":"HSDPA 850"}
如何以格式将数据放入数组中:
array(["2G Network"]=>"GSM 850", ["3G Network"]=>"HSDPA 850");
这个想法如何
$data = '{"2G Network":"GSM 850","3G Network":"HSDPA 850"}';
$myArray = json_decode( $data, true ); //true to make it associative array
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json, true));
array(5) {
["a"] => int(1)
["b"] => int(2)
["c"] => int(3)
["d"] => int(4)
["e"] => int(5)
}
$text = '{"2G Network":"GSM 850","3G Network":"HSDPA 850"}';
$myArray = json_decode($text, true);
采用:
echo $myArray['2G Network'];