我有以下 temp.XML 文档:
<?xml version="1.0" encoding="UTF-8"?>
<services_api_response version="2.0">
<status>
<code>0</code>
<message>OK</message>
</status>
<service id="82dadd66a5048cc85ed0b8da1d835f2a">
<countries>
<country code="BA" vat="17.00" approved="true" name="Bosnia and Herzegovina">
<prices>
<price vat_included="false" currency="BAM" all_operators="true" amount="2.00">
<message_profile shortcode="091810700" all_operators="true" keyword="TXT ABC">
<operator code="BH Mobile" billing_type="MO" revenue="0.84" default_billing_status="OK" name="BH Mobile"/>
<operator code="HT-ERONET" billing_type="MO" revenue="0.84" default_billing_status="OK" name="HT-ERONET"/>
<operator code="M:tel" billing_type="MT" revenue="0.84" default_billing_status="Failed" name="M:tel"/>
</message_profile>
</price>
</prices>
<promotional_text>
<local>Cena: 2,00 BAM + PDV
Podrška: 000000000| bbb@ccc.com Mobilna Naplata: fortumo.com</local>
<english>Price: 2.00 BAM + VAT
Support: 000000000| bbb@ccc.com
Mobile Payment by fortumo.com</english>
</promotional_text>
</country>
</countries>
</service>
</services_api_response>
和 PHP 文件:
$obj = simplexml_load_file('temp.xml');
echo '---> '.$obj -> countries[0] -> promotional_text[0] -> local[0];
但我什么也得不到。