我已經成功地用PayPal和我自己的付費按鈕設置了Sandbo。現在,在我的感謝頁面中,用戶在重新定向後,我想將詳細信息打印給用戶。通過PDT,我可以獲得發送的數據,以及我如何使用它來呈現數據。需要PDT提取和呈現數據方面的幫助
我有數據$ keyarray,這是一些我PDT的PHP代碼: 截圖:http://snag.gy/PdsQH.jpg
$firstname = $keyarray['first_name'];
$lastname = $keyarray['last_name'];
$itemname = $keyarray['item_name'];
$amount = $keyarray['payment_gross'];
$id = $keyarray['item_number'];
echo ("<div id='welcomeText'>Thank you for your purchase!</div>");
echo ("<p><div id='bold'>Payment Details</div></p><br>\n");
echo ("<div class='abouttext'>Name: $firstname $lastname</div>\n");
$string1 = 'item_number';
$string2 = 'item_name';
$string3 = 'quantity';
$count = count($keyarray);
for($idx = 1; $idx < $count; $idx ++) {
if (isset($string2) && 'item_name' != null)
echo ("<div class='abouttext'>Item name: ".$keyarray[$string2.$idx]."</div>\n");
echo ("<div class='abouttext'>Item ID: ".$keyarray[$string1.$idx]."</div>\n");
echo ("<div class='abouttext'>Qty: ".$keyarray[$string3.$idx]."</div>\n");
}
的問題是,它循環65次,因爲它是那麼長。我想改變$ count = count($ keyarray);來代替次數item_number在$ keyarray中,類似於 $ count = count($ keyarray ['item_number'); - 那可能嗎?我也可以用10而不是$ count進行硬編碼,並將其循環10次,結果不會那麼糟糕。
其中是'item_number4'和'item_number5'? – SparKot 2013-02-27 15:34:11
他們還沒有使用,但沒有什麼區別。我需要知道如何遍歷發送的transationID($ keyarray),並且每次發生$ id/item_number都會回顯該產品的詳細信息。 – 2013-02-27 15:46:30
現在foreach中的$ id($ keyarray as $ id)就是每個條目的值 – 2013-02-27 15:49:03