그래서 기본적으로 foreach를 사용하여 일부 변수를 표시하는 것이지만 하위 루프가 있으므로 중첩 루프를 사용해야합니다.중첩 된 Foreach 루프 (PHP)
<whmcsapi>
<action>getclientsdomains</action>
<clientid>123</clientid>
<totalresults>2</totalresults>
<startnumber>0</startnumber>
<numreturned>2</numreturned>
<domains>
<domain>
<id>1</id>
<userid>123</userid>
<orderid>1</orderid>
<regtype>Register</regtype>
<domainname>whmcsdomain.com</domainname>
<registrar>enom</registrar>
<regperiod>1</regperiod>
<firstpaymentamount>8.95</firstpaymentamount>
<recurringamount>8.95</recurringamount>
<paymentmethod>paypal</paymentmethod>
<paymentmethodname>Credit Card or Debit Card</paymentmethodname>
<regdate>2011-01-01</regdate>
<expirydate>2012-01-01</expirydate>
<nextduedate>2012-01-01</nextduedate>
<status>Active</status>
<subscriptionid></subscriptionid>
<dnsmanagement></dnsmanagement>
<emailforwarding></emailforwarding>
<idprotection></idprotection>
<donotrenew></donotrenew>
<notes></notes>
</domain>
...
</domains>
</whmcsapi>
첫 번째 카테고리 하나이다 :
이
목록이다.이 내가 결과없이 지금까지하지만 달성 한 것입니다 : 사전에
result success
clientid 1
domainid
totalresults 1
startnumber 0
numreturned 1
domains Array
Array
감사 :
$command = 'getclientsdomains';
$values = array('clientid' => $_SESSION['uid']);
# Call API
$results = localAPI($command,$values);
foreach ($results as $id => $result) {
echo $id . " " . $result ."<br />";
foreach ($result as $domains) {
echo $domains;
foreach($domains as $key => $value) {
echo $key . $value;
}
}
}
이 출력됩니다.
당신이 당신의 배열 값에 print_r의 사용하려고 했 데이터를 통해 루프 재귀 함수를 사용? - 그것은 배열의 숨겨진 내용을 공개합니다;) –