0
在PHP中使用Stripe API所有試圖從其中取出值的操作都返回null,r根本不顯示結果。我試過Stripe API JSON返回null
$customers = \Stripe\Customer::all();
$customers_json = $customers->__toJSON();
json_decode($customers_json);
echo $customers_json->data->id;
也
$customers = \Stripe\Customer::all();
$customer = $customers->__toArray(true);
echo $customer["data"]["id"];
但每次結果都在一個空白的回聲。然而,當我只輸出原始變量而不解析爲JSON或任何東西時,它會返回一個完整的JSON值的字符串,而不是解析。的只是原始$customers
輸出是
Stripe\Collection JSON: { "object": "list", "has_more": false, "url": "\/v1\/customers", "data": [ { "id": "cus_6u32tOQ6MRXuqm", "object": "customer", "created": 1441114587, "livemode": false, "description": "test customer", "email": "[email protected]", "shipping": null, "delinquent": false, "metadata": [ ], "subscriptions": { "object": "list", "total_count": 0, "has_more": false, "url": "\/v1\/customers\/cus_6u32tOQ6MRXuqm\/subscriptions", "data": [ ] }, "discount": null, "account_balance": 0, "currency": null, "sources": { "object": "list", "total_count": 0, "has_more": false, "url": "\/v1\/customers\/cus_6u32tOQ6MRXuqm\/sources", "data": [ ] }, "default_source": null } ] }
你能否告訴我們'$客戶'全力輸出? – arik
現在加入吧,對不起 – Wargog