【发布时间】:2019-06-05 02:01:17
【问题描述】:
我无法从对象中获取数组:
请看下面我的代码:
print_r($product_ser_id);
打印结果:
WHMCS\Service\Service Object
(
[table:protected] => tblhosting
[columnMap:protected] => Array
(
[clientId] => userid
[productId] => packageid
[serverId] => server
[registrationDate] => regdate
[paymentGateway] => paymentmethod
[status] => domainstatus
[promotionId] => promoid
[overrideAutoSuspend] => overideautosuspend
[overrideSuspendUntilDate] => overidesuspenduntil
[bandwidthUsage] => bwusage
[bandwidthLimit] => bwlimit
[lastUpdateDate] => lastupdate
[firstPaymentAmount] => firstpaymentamount
[recurringAmount] => amount
[recurringFee] => amount
)
}
这里我必须从[productId]获得价值
我已经测试为:$product_ser_id -> attributes:protected;
其显示错误为:
ParseError: syntax error, unexpected ':' in
我知道有很多例子,所以在你真正理解我的问题之前,请不要重复。
请帮忙
谢谢
【问题讨论】:
-
你没有吸气剂吗?
-
如果不扩展 WHMCS\Service\Service 或更改 WHMCS\Service\Service 类,您将无法获取该数组,因为它是受保护的。您可以创建一个适配器并扩展服务,然后创建一个返回它的方法。
-
@CésarFerreira 请帮忙,大多数人都在说重复而没有理解受保护