我想不出一种方法来编写一个 PHP 脚本来打印这个多维数组的名字、姓氏、电子邮件和帐户 ID。这是从 cURL 脚本返回的 json 数据。你能帮我我的朋友吗?
Array
(
[operationResult] => SUCCESS
[responseDateTime] => 2013-03-15T15:52:25.180-05:00
[page] => Array
(
[currentPage] => 1
[pageSize] => 10
[totalPage] => 1
[totalResults] => 1
)
[searchResults] => Array
(
[nameValuePairs] => Array
(
[nameValuePair] => Array
(
[0] => Array
(
[name] => Account Id
[value] => 7601
)
[1] => Array
(
[name] => User Email 1
[value] => jim@email.com
)
[2] => Array
(
[name] => First Name
[value] => Jim
)
[3] => Array
(
[name] => Last Name
[value] => Burns
)
)
)
)
)
编辑:很抱歉不包括我的尝试。我尝试了以下方法:
foreach ($client_emails_array as $operation)
{
echo $operation['page']['searchResults']['nameValuePairs']['nameValuePair']['name']."<br>";
echo $operation['page']['searchResults']['nameValuePairs']['nameValuePair']['value']."<br>";
}
这给了我一点成功