{"TransactionInfo":{"Date":"06\/04\/2018","Time":"09:29 ET","TransactionCharge":{"MonetaryValue":"0.00","CurrencyCode":{}}},"ShipmentEstimate":{"CurrencyCode":"EUR","ShipmentCharges":{"TaxesAndFees":"1.7532","AdditionalInsuranceCost":"0.00","TransportationCost":"0.00","SubTotal":"1.7532"},"ProductsCharges":{"Product":{"TariffCode":"5109.90.80.00","Charges":{"Duties":"75.0021","TaxesAndFees":"0.00","VAT":"0.00","CostOfGoods":"1250.00","SubTotal":"1325.0021"}},"ProductsSubTotal":"1325.0021"},"TotalLandedCost":"1326.7553"},"SuppressQuestionIndicator":"Y"}
如何才能获得TariffCode的值? 结果必须是:5109.90.80.00
答案 0 :(得分:0)
<?php
$json = '{"TransactionInfo":{"Date":"06\/04\/2018","Time":"09:29 ET","TransactionCharge":{"MonetaryValue":"0.00","CurrencyCode":{}}},"ShipmentEstimate":{"CurrencyCode":"EUR","ShipmentCharges":{"TaxesAndFees":"1.7532","AdditionalInsuranceCost":"0.00","TransportationCost":"0.00","SubTotal":"1.7532"},"ProductsCharges":{"Product":{"TariffCode":"5109.90.80.00","Charges":{"Duties":"75.0021","TaxesAndFees":"0.00","VAT":"0.00","CostOfGoods":"1250.00","SubTotal":"1325.0021"}},"ProductsSubTotal":"1325.0021"},"TotalLandedCost":"1326.7553"},"SuppressQuestionIndicator":"Y"}';
$array = json_decode($json, true);
echo $array['ShipmentEstimate']['ProductsCharges']['Product']['TariffCode'];
在此处查看此行动:https://3v4l.org/2WBs6