PHP eBay API 对象值

PHP eBay API Object Values

我正在使用 eBay API,并且正在使用 GetSingleItem 检索 eBay 项目数据。从这些数据中,我想从返回的对象中提取价格:

DTS\eBaySDK\Shopping\Types\AmountType Object
            (
                [values:DTS\eBaySDK\Types\BaseType:private] => Array
                    (
                        [currencyID] => USD
                        [value] => 19.99
                    )

                [attachment:DTS\eBaySDK\Types\BaseType:private] => Array
                    (
                        [data] =>
                        [mimeType] =>
                    )

            )

我试过将对象转换为数组,我试过使用 obj->values->value。 如何从值数组中检索价格数据 (19.99)?

您可能会想要 $item->CurrentPrice->value。例如:

$response = $service->getSingleItem($request); $item = $response->Item; $item->CurrentPrice->value;

以防万一你不知道有一个example of using the SDK for calling GetSingleItem