请教php大神,如何提取一个json数据里的某值?

{"code":"0","data":[{"sub":"iat","auth_id":"688093481a516772850fe01f02b1896a","text":... {"code":"0","data":[{"sub":"iat","auth_id":"688093481a516772850fe01f02b1896a","text":{"bg":0,"ed":0,"ls":false,"sn":1,"ws":[{"bg":1,"cw":[{"sc":0,"w":"200"}]},{"bg":1,"cw":[{"sc":0,"w":"-"}]},{"bg":1,"cw":[{"sc":0,"w":"99"}]},{"bg":1,"cw":[{"sc":0,"w":"等于"}]},{"bg":1,"cw":[{"sc":0,"w":"多少"}]}]},"result_id":1},{"sub":"iat","auth_id":"688093481a516772850fe01f02b1896a","text":{"bg":0,"ed":0,"ls":true,"sn":2,"ws":[{"bg":0,"cw":[{"sc":0,"w":""}]}]},"result_id":2},{"sub":"nlp","auth_id":"688093481a516772850fe01f02b1896a","intent":{},"result_id":2},{"sub":"nlp","auth_id":"688093481a516772850fe01f02b1896a","intent":{"answer":{"text":"等于101","type":"T"},"expression":"200-99","match_info":{"type":"gparser_path","value":"----------"},"operation":"ANSWER","rc":0,"service":"calc","sid":"atn0054134e@dx00070ee3fb04a10e01","state":{"fg::weather::default::default":{"state":"default"}},"text":"200-99等于多少","uuid":"atn0054134e@dx00070ee3fb04a10e01"},"result_id":1}],"desc":"success","sid":"ara0013dcae@dx2c850ee3fb04090000"}我想提取最后一组data【3】里的intent下的text值和intent下的answer下的text值请教php源码,谢谢 展开
 我来答
app_versionbff
2018-08-31 · TA获得超过436个赞
知道小有建树答主
回答量:402
采纳率:97%
帮助的人:309万
展开全部
这个问题很简单,在php里json格式就是字符串,可以用php内置函数json_decode($json,true)转化成数组,取嫌肆数组的值带消你芹行轿应该知道怎么弄了吧
追问
取code、sid我知道
$object = json_decode($result);
echo $object->sid;
echo $object->code;
但是取data【3】里的intent下的text值和intent下的answer下的text值就真的不知道了,小白。请赐教
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式