我正在学习coinbase api并搞乱php。我似乎无法从数组中添加数据作为变量,因为数组是私有的。如何将私有值设置为变量?
$coinbaseconf = 配置::apiKey($coinbaseapi, $coinbasesecret); $client = Client::create($coinbaseconf);
返回
Coinbase\Wallet\Value\Money 对象([amount:Coinbase\Wallet\Value\Money:private] => 5567.17 [currency:Coinbase\Wallet\Value\Money:private] => GBP)
如果我尝试:
$var1 = $btcusdsellprice->金额;
获取错误
致命错误:未捕获错误:无法访问私有财产 Coinbase\Wallet\Value\Money::$amount in /var/www/html/xxx/xxx.php:22 堆栈跟踪:#0 {main} 在 /var/var 中抛出/www/html/xxx.php 第 22 行