0
이것은 2co에 대한 다중 배열입니다. 반환 값을 가져 와서 관리자에게 전자 메일로 보내려고하지만이 배열의 값에 액세스 할 수 없습니다.왜이 배열 요소에 액세스 할 수 없습니다
<?php
require_once 'payment-api/Twocheckout.php';
Twocheckout::privateKey('4D67BA12-CE09-4F1D-AB20-0133F24E3472');
Twocheckout::sellerId('901249656');
Twocheckout::sandbox(true);
try {
$charge = Twocheckout_Charge::auth(array(
"merchantOrderId" => "123",
"token" => $_POST['token'],
"currency" => 'USD',
"total" => '10.00',
"billingAddr" => array(
"name" => 'Testing Tester',
"addrLine1" => '123 Test St',
"city" => 'Columbus',
"state" => 'OH',
"zipCode" => '43123',
"country" => 'USA',
"email" => '[email protected]',
"phoneNumber" => '555-555-5555'
)
));
if ($charge['response']['responseCode'] == 'APPROVED') {
echo "Thanks for your Order!";
echo "<h3>Return Parameters:</h3>";
echo "<pre>";
echo "His name" . $charge['billingAddr']['name'];
echo "</pre>";
}
} catch (Twocheckout_Error $e) {
print_r($e->getMessage());
}
이것은이 값에 액세스하는 방법입니다.
echo "His name" . $charge['billingAddr']['name'];
내가 여기서 잘못하고있는 것. 당신은 response
키에 액세스하는 것을 잊지했습니다
$charge['response']['billingAddr']['name'];
을 : 내가 print_r($charge);
Array
(
[validationErrors] =>
[exception] =>
[response] => Array
(
[type] => AuthResponse
[currencyCode] => USD
[shippingAddr] => Array
(
[addrLine1] =>
[addrLine2] =>
[city] =>
[zipCode] =>
[phoneNumber] =>
[phoneExtension] =>
[email] =>
[name] =>
[state] =>
[country] =>
)
[merchantOrderId] => 123
[orderNumber] => 9093719883561
[transactionId] => 9093719883582
[billingAddr] => Array
(
[addrLine1] => 123 Test St
[addrLine2] =>
[city] => Columbus
[zipCode] => 43123
[phoneNumber] => 555-555-5555
[phoneExtension] =>
[email] => [email protected]
[name] => Testing Tester
[state] => OH
[country] => USA
)
[lineItems] => Array
(
[0] => Array
(
[duration] =>
[options] => Array
(
)
[description] =>
[price] => 10.00
[quantity] => 1
[recurrence] =>
[startupFee] =>
[productId] =>
[tangible] => N
[name] => 123
[type] => product
)
)
[recurrentInstallmentId] =>
[responseMsg] => Successfully authorized the provided credit card
[responseCode] => APPROVED
[total] => 10.00
[errors] =>
)
)
이 에코에서 무엇을 얻나요 ?? – goseo
'Twocheckout_Charge :: auth'이 무엇을하지 않고 말하기가 어렵습니다. 'var_dump ($ charge)'를 체크하면 아마 문제가 나타날 것이다. – evilive
먼저 print_r ($ charge)을 참조하십시오. –