想知道如何从此数组中获取以下值:campaignID、campaign、impressions、clicks 和 cost。例如,我想得到以下结果:
广告活动 ID - 9039077962 广告活动:CG - 智能购物 - 美国 展示次数 - 1951940 次点击 - 10726 费用 - 5324010696
我已经从 forloop 开始,但无法获取任何值,我刚刚得到: ArrayArrayArray
for($i = 0; $i < count($array); $i++) {
echo $array[2]['row'][$i]['@attributes']['campaignID'];
}
这是我的数组,它的打印结果:
$array = simplexml_load_string($reportDownloadResult->getAsString());
print_r( $result );
RESULTS------------------------------------------->
Array
(
[report-name] => Array
(
[@attributes] => Array
(
[name] => CAMPAIGN_PERFORMANCE_REPORT
)
)
[date-range] => Array
(
[@attributes] => Array
(
[date] => Jul 13, 2020-Jul 19, 2020
)
)
[table] => Array
(
[columns] => Array
(
[column] => Array
(
[0] => Array
(
[@attributes] => Array
(
[name] => campaignID
[display] => Campaign ID
)
)
[1] => Array
(
[@attributes] => Array
(
[name] => campaign
[display] => Campaign
)
)
繁花如伊
心有法竹