一直试图从这个数组中回显这些单独的值
echo var_dump($memberships);
我试图回显的两个值是 ["name"] 和 ["status"]
这就是我试图回应这些价值观的原因:
if ( $memberships ) {
foreach( $memberships[0] as $membership ) {
echo $membership["plan"]["name"];
}
}
我也试过这个:
echo $memberships[0]['plan']['name'];
这是 var_dump 的一部分(堆栈不允许我放置整个内容):
array(1) {
[0]=>
object(WC_Memberships_Integration_Subscriptions_User_Membership)#23837 (22) {
["subscription_id":protected]=>
int(103981)
["subscription_id_meta":protected]=>
string(16) "_subscription_id"
["has_installment_plan_meta":protected]=>
string(21) "_has_installment_plan"
["free_trial_end_date_meta":protected]=>
string(20) "_free_trial_end_date"
["id"]=>
int(104104)
["plan_id"]=>
int(98065)
["plan"]=>
object(WC_Memberships_Integration_Subscriptions_Membership_Plan)#23902 (19) {
["installment_plan_meta":protected]=>
string(30) "_subscription_installment_plan"
["id"]=>
int(98065)
["name"]=>
string(19) "Full Premium Member"