我有一个从Expedia API响应的对象。
[Surcharges] => stdClass Object
(
[@size] => 1
[Surcharge] => stdClass Object
(
[@type] => TaxAndServiceFee
[@amount] => 9.59
)
)
如何检索@typevà@ amount属性。
我尝试了宽度Surcharges->Surcharge->type
或Surcharges->Surcharge->@type
,但没有成功
答案 0 :(得分:2)
尝试使用
Surcharges->Surcharge->{"@type"}
答案 1 :(得分:1)
尝试
Surcharges->Surcharge->{"@type"}