Mandrill应用程序返回:[{"email":"steven@gmail.com","status":"sent","_id":"234we4fvba4a3e8517d7a9","reject_reason":null}]
我只需要获得" status"的价值。这样的事情:echo $result['status'];
我怎么能在PHP中做到这一点?
答案 0 :(得分:2)
使用json_decode()
获取状态..就像这样:
<?php
$str = '[{"email":"steven@gmail.com","status":"sent","_id":"234we4fvba4a3e8517d7a9","reject_reason":null}]';
$json = json_decode($str, true);
echo $json[0]['status'];
?>
答案 1 :(得分:0)
你可以使用
$json = '[{"email":"steven@gmail.com","status":"sent","_id":"234we4fvba4a3e8517d7a9","reject_reason":null}]';
$json_array = json_decode($json);
print "<pre>";print_r($json_array[0]->status);