‘壹’ php解析json数据
<?php
$json = '{"APPCount": 2,"data": [
{
"originalID": "991",
"APPName": "优酷",
"APPType": "APK",
"category": "视频",
"versionName": "3.8",
"versionCode": "5",
"packageName ": "cn.dsp.youku",
" APPStatus": "待审核",
"testReportURL": "",
"downloadCount": 0
},
{
"originalID": "992",
"APPName": "优酷",
"APPType": "APK",
"category": "视频",
"versionName": "3.8",
"versionCode": "5",
"packageName ": "cn.dsp.youku",
" APPStatus": "安全测评未通过",
"testReportURL": "http: //192.168.0.106: /SecurityTest/sdsd.pdf",
"downloadCount": 0
}
]
}';
$decode = json_decode($json,true);
echo $decode['data'][1]['testReportURL'];
‘贰’ 如何在PHP中解析json
给出例子供参考:
<?php
// Encode the data.
$json = json_encode(
array(
1 => array(
'English' => array(
'One',
'January'
),
'French' => array(
'Une',
'Janvier'
)
)
)
);
// Define the errors.
$constants = get_defined_constants(true);
$json_errors = array();
foreach ($constants["json"] as $name => $value) {
if (!strncmp($name, "JSON_ERROR_", 11)) {
$json_errors[$value] = $name;
}
}
// Show the errors for different depths.
foreach (range(4, 3, -1) as $depth) {
var_mp(json_decode($json, true, $depth));
echo 'Last error: ', $json_errors[json_last_error()], PHP_EOL, PHP_EOL;
}
?>
‘叁’ 如何在PHP中解析json
json_encode()
该函数主要用来将数组和对象,转换为json格式。先看一个数组转换的例子:
$arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5);
echo json_encode($arr);
‘肆’ php 怎么解释返回的json数据
php 输出JSON格式,使用json_encode函数即可 例如: 得到结果: {"fruits":{"a":"orange","b":"banana","c":"apple"},"numbers":[1,2,3,4,5,6],"holes":{"0":"first","5":"second","6":"third"}}
‘伍’ PHP 如何解析 json
alert(send);
ajax=tel();
ajax.open("post", "setLine.class.php",true);
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
// 改成这样就可以了
ajax.send({
'lineA':JSON.stringify(send);
});
‘陆’ PHP解析JSON
echo$json->a[0]->date;
//数组和普通数组一样,json对象使用对象序列化,上面的json意义上等价于():
classsubobj
{
var$date='20150101';
}
classobj
{
var$a=array(newsubobj());
}
$json=newobj();
‘柒’ php 解析JSON
你看看这个例子:
<?php
$postArray ='[{"data":{"hello":"world"},"type":"1234","date":"2012-10-30 17:6:9","user":"000000000000000","time_stamp":1351587969902}, {"data":{"hello":"world"},"type":"1234","date":"2012-10-30 17:12:53","user":"000000000000000","time_stamp":1351588373519}]';
$de_json = json_decode($postArray,TRUE);
$count_json = count($de_json);
for ($i = 0; $i < $count_json; $i++)
{
//echo var_mp($de_json);
$dt_record = $de_json[$i]['date'];
$data_type = $de_json[$i]['type'];
$imei = $de_json[$i]['user'];
$message = json_encode($de_json[$i]['data']);
}
?>如果还有更多问题可以去后盾网论坛问题求助专区。
‘捌’ PHP解析json
你得把 {"班级", A} 的 A 改成字串,变成这样 {"班级", "A"}
不懂可以私信问我详细
‘玖’ 如何在PHP中解析json
PHP里面有json_encode(数组)可以把数组给转换成JSON字符串,
而json_decode(JSON字符串,boolean)可以把JSON字符串转换成数组或者对象类型,第二个参数boolean默认为false表示对象类型,true表示解析为数组类型通过下表访问
‘拾’ php如何解析json
用json_decode函数将json字符串转换为数组
<?php
$json = '{"multi-i1ndex-style":{"old":{"0.1":"123","0.2":"234"}}}';
echo "<pre>";
print_r(json_decode($json, true));
echo "</pre>";