这是我从 clickbank 收到的即时付款通知 (IPN) 的示例:
$decrypted = {"transactionTime":"2014-10-06T14:49:00-07:00","receipt":"********","transactionType":"TEST","vendor":"comclub","role":"VENDOR","totalAccountAmount":1.00,"paymentMethod":"VISA","totalOrderAmount":1.00,"totalTaxAmount":0.00,"totalShippingAmount":0.00,"currency":"USD","lineItems":[{"itemNo":"1","productTitle":"A passed in title","shippable":false,"recurring":false,"accountAmount":1.00}],"customer":{"shipping":{"firstName":"TEST","lastName":"USER","fullName":"Test User","email":"testuser@somesite.com","address":{}},"billing":{"firstName":"TEST","lastName":"USER","fullName":"Test User","email":"testuser@somesite.com","address":{}}},"version":6.0,"attemptCount":1}
所以我愿意$order = json_decode($decrypted);
现在我想取出各个变量。
起初,它工作正常。例如,我可以做
$transactionTime = $order->transactionTime;
但是当我使用 lineItems 达到 2 级的东西时,我不知所措。
我尝试了各种各样的事情:
$itemNo = $order['lineItems']['itemNo'];
$itemNo = $order['lineItems']->itemNo;
$lineItems = $order['lineItems'];
$itemNo = $lineItems['itemNo'];
但似乎没有任何效果。
我也试过
$order = json_decode($decrypted, TRUE);
但这也不起作用
例如,有谁知道如何获取 itemNo 变量?
谢谢