Bir json dizisinden veri ayıklamaya çalışıyorum ancak her zaman boş bir dizim var.Bir JSON dizisinden veriyi ayıkla php
Benim XML: XML
<?xml version="1.0" encoding="UTF-8"?>
<ItemList>
<Entry Item = "test1" Object = "1tset" />
<Entry Item = "test2" Object = "2tset" />
</ItemList>
Benim Dökümü:
array(1) { ["Entry"]=> array(2)
{ [0]=> array(1) { ["@attributes"]=> array(2) { ["Item"]=> string(5) "test1" ["Object"]=> string(5) "1tset" } }
[1]=> array(1) { ["@attributes"]=> array(2) { ["Item"]=> string(5) "test2" ["Object"]=> string(5) "2tset" } } } }
Benim php kodu: Bütün "Öğe" veya "Object" dan almak gerekir
$xmlString = "my.xml";
$xmlObject = simplexml_load_file($xmlString);
$xmltovar = json_decode(json_encode($xmlObject), true);
foreach($xmltovar['Entry'] as $test) {
echo $test['Item']."<br>";
}
ItemList-> Giriş Etiketi.