현재 내가 다음 코드하지만 어떤 이유로 만 출력됩니다의 Foreach 표시되지 않는 하나 이상의 변수
은 기본적으로 내가해야 할 시도 무엇 foreach는 mainPropertyUrl
이 목록 목록의 foreach 문을 만들라고 하나 개 항목을 가지고 있지만 몇 가지 이유 난 단지 주요 사료가 위치한 하나 ListingId
을 다시 얻고 - http://api.trademe.co.nz/v1/Member/4389666/Listings/All.xml
PHP :
$mainXmlUrl = simplexml_load_file("http://api.trademe.co.nz/v1/Member/4389666/Listings/All.xml");
$listing = $mainXmlUrl->List->Listing;
$mainPropertyUrl = simplexml_load_file("http://api.trademe.co.nz/v1/Listings/$listing->ListingId.xml");
내 HTML에서는 일반적인 foreach 루프를 수행했지만 $url
변수를 사용하지 않으려 고했지만 하나의 목록에 대해 작동하는 코드로 구현하는 방법을 잘 모르겠습니다.
$ListingArray = array();
foreach ($listing[0] as $id) {
$IDNum = $id->ListingId;
$ListingArray[] = $IDNum;
}
var_dump($ListingArray);
HTML SNIPPIT :
<?php foreach ($mainPropertyUrl as $url): ?>
<div class="listingContainer">
<h2><?php echo $tradeMePropertyAddressFull;?></h2>
<div class="listingAttributes">
<div class="col0">
<span class="name"><?php echo $mainPropertyDetails[0]->Attribute[0]->DisplayName;?>:</span>
<span class="value"><?php echo $tradeMePropertyBathrooms[0];?></span>
http://pinterest.com/pin/343118065329946155/ – markus