我有以下数组:
Array (
[result] => Array (
[id] => 58fba3ebf4
[type] => A
[name] => ser.domain.com
[content] => 192.168.100.1
[proxiable] =>
[proxied] =>
[ttl] => 1
[priority] => 10
[locked] =>
[zone_id] => eb0d86828e3ac837c
[zone_name] => domain.com
[modified_on] => 2018-07-06T06:37:14.069598Z
[created_on] => 2018-07-06T06:37:14.069598Z
[meta] => Array (
[auto_added] =>
[managed_by_apps] =>
[managed_by_argo_tunnel] =>
)
)
[success] => 1
[errors] => Array ( )
[messages] => Array ( )
)
我怎样才能从id
中获得价值?
答案 0 :(得分:0)
$data =json_decode($response);
$id = $data->result->id;
假设请求中的有效负载为$ response。
答案 1 :(得分:0)
这是解决方法
// $ result_array()是来自curl PHP的响应
$ data = $ result_array();
$ id = $ data ['result'] ['id'];
答案 2 :(得分:0)
您已经有一个多维数组,因此只需尝试
echo $arrays['result']['id']; // this will return id
echo $arrays['result']['type']; // this will return type