PHP acemi duyuyorum. Ben bu xml dosyasını ayrıştırmak çalışıyorum.
<relationship>
<target>
<following type="boolean">true</following>
<followed_by type="boolean">true</followed_by>
<screen_name>xxxx</screen_name>
<id type="integer">xxxx</id>
</target>
<source>
<notifications_enabled nil="true"/>
<following type="boolean">true</following>
<blocking nil="true"/>
<followed_by type="boolean">true</followed_by>
<screen_name>xxxx</screen_name>
<id type="integer">xxxxx</id>
</source>
</relationship>
Ben hedef için 'type = "boolean" aşağıdaki "alanının değerini almak gerekiyor ve benim kod -
$xml = simplexml_load_string($response);
foreach($xml->children() as $child)
{
if ($child->getName() == 'target')
{
foreach($child->children() as $child_1)
if ( $child_1->getName() == 'following')
{
$is_my_friend = (bool)$child_1;
break;
}
break;
}
}
ama ben doğru çıktı almıyorum. Ben 'type = "boolean"' alanının bir parçası sorunlar yaratıyor düşünüyorum. Lütfen yardım edin.