我正在尝试使用 PHP 和官方 Amazon AWS PHP SDK 从 SimpleDB 获取域列表。我的代码得到了一些东西,但它似乎在循环错误的东西。
这是我的代码:
<?php
// Include the SDK
require_once 'sdk.class.php';
// Include the SDK
$sdb = new AmazonSDB();
$domainList = $sdb->listDomains();
echo "<pre>";
print_r($domainList, false);
echo "</pre>";
echo "<br><br><br>";
if ($domainList) {
foreach ($domainList as $domainName) {
$domain_name = $domainName->ListDomainsResult->DomainName;
echo "Domain: " . $domain_name . "<br>";
}
}
echo "<br><br><br>";
$request_id = $response->body->ResponseMetadata->RequestId;
$cost = $response->body->ResponseMetadata->BoxUsage;
echo "Request ID: " . $request_id . "<br>";
echo "Cost: " . $cost . "<br>";
?>
我得到以下输出的那一刻
Domain:
Domain: test05
Domain:
我应该得到:
test05
test06
test07