【发布时间】:2015-07-18 07:15:23
【问题描述】:
我的函数能够检索 1 级数组数据,但不能在收费后的返回 JSON 字符串中检索 2 级。
else if(!empty($_SESSION['SESS_PLAN_BUY_CODE'])){
$pcharge = \Stripe\Customer::create(array(
"source" => $_POST['stripeToken'],
"plan" => $_SESSION['SESS_PLAN_BUY_CODE'],
"email" => $_SESSION["SESS_EMAIL"]
));
echo "My customer id is: " . $pcharge->id;
echo'<br>';
$stuff = json_decode($pcharge->subscriptions);
var_dump($stuff);
实际的 JSON 返回字符串: JSON
上面代码的输出是:
我的客户id 是:cus_6cvCQdpdhmQlGe
NULL
预期输出:
我的客户id 是:cus_6cvCQdpdhmQlGe
1
我试过了:
$stuff = $pcharge->subscriptions[0];
$stuff = $pcharge->subscriptions['total_count'];
$stuff = json_decode($pcharge->subscriptions);
和几个循环
我收到NULL 或其他一些错误,表明程序员不知道他在做什么。
如何获取 Stripe JSON 返回字符串中的level 2 和level 3 数据?
【问题讨论】:
标签: php json stripe-payments