从mandrillapp数组的返回值获取数据 [英] get data from return value of mandrillapp array
本文介绍了从mandrillapp数组的返回值获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Mandrill应用返回以下内容:[{"email":"steven@gmail.com","status":"sent","_id":"234we4fvba4a3e8517d7a9","reject_reason":null}]
Mandrill app return this : [{"email":"steven@gmail.com","status":"sent","_id":"234we4fvba4a3e8517d7a9","reject_reason":null}]
我只需要获取状态"的值.像这样:echo $result['status'];
如何在PHP中做到这一点?
I need to get only the value of "status". Something like this: echo $result['status'];
How can I do it in PHP?
推荐答案
使用json_decode()
获取状态.
<?php
$str = '[{"email":"steven@gmail.com","status":"sent","_id":"234we4fvba4a3e8517d7a9","reject_reason":null}]';
$json = json_decode($str, true);
echo $json[0]['status'];
?>
这篇关于从mandrillapp数组的返回值获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文