从 mandrillapp 数组的 return 值获取数据

get data from return value of mandrillapp array

Mandrill 应用程序 return 这个:[{"email":"steven@gmail.com","status":"sent","_id":"234we4fvba4a3e8517d7a9","reject_reason":null}]

我只需要获取 "status" 的值。像这样:echo $result['status']; 我怎样才能在 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'];

 ?>

你可以像这样使用

$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);