0

XML から製品を取得するためのコードを以下に示します。Merchant ロゴの URL 以外のすべての子にアクセスできます。マーチャントのロゴの URL にアクセスする方法を教えてください。

foreach ($productsResult->Products->Product as $result) {

echo "<a href=".$result->Offer->Url." target='_blank'><img class='productImg' src=".$result->Offer->Images[0]->Image->Url."/></a>"; 
echo "<p><b class='price'>£".$result->Offer->Price->Price."</b></p><br>";
echo "<p><img src=".$result->Offer->Merchant[0]->Name->Logo->Url."/></p>"; *// This is where I need help*
echo "<p class='title'>".$result->Offer->Title.".</p><a class='goToStore w3-btn w3-blue' href=".$result->Offer->Url." target='_blank'><b>Visit Store</b></a>";

<Products>
 <Product>	
  <Offer>
   <Title></Title>
   <Description> </Description>
   <Images>
    <Image available="true">
    <Url></Url>
    <Height></Height>
    <Width></Width>
    </Image>
   <Merchant>
    <Name></Name>
    <Logo>
     <Url>The URL I need</Url>
     <Width></Width>
     <Height></Height>
     </Logo>
     </Merchant>

ありがとう、

4

1 に答える 1

0

なぜインデックスを使用しているのですか?私はそれがちょうどあるべきであるように見えます:

$result->Offer->Merchant->Logo->Url
于 2016-03-28T16:39:46.533 に答える