【小(xiǎo)編推薦】zencart集成支付寶借口時(shí)提示ILLE∑&GAL_SIGN 錯(cuò)誤解決

2014-07-05  &nb$&<sp;|   發布者:梁國(∞¶guó)芳   | &nb↔→≤♦sp; 查看(kàn):3320次✘∑↑β

php
 之前上(shàng)傳了(le) zen c↓≈γart 支付寶模塊,從(cóng)後台安裝一€•♦(yī)切ok,可(kě)是(shì)測試購(gòu)物(wù)的(de) ‍時(shí)候遇到(dào)了(le) ILLEGAL_SIGN錯(cuò)₹σ↑≤誤,找了(le)很(hěn)多(duō)答(dá)案,仔仔細細看♥®♣(kàn)了(le)阿裡(lǐ)提供的(de)api文(wén)檔,還(hái♠ ♦£)是(shì)找不(bù)出問(wèn)題所在。看(kàn)來(lái)得δ ₽£(de)靠自(zì)己了(le),對(duì)著(zhe)firebug,一(₽αyī)個(gè)個(gè)核對(duì) 網站(zhà↔γ±n)傳輸給支付寶的(de)post數(shù)據,發現(xiàn)多("& πduō)了(le) btn_submit. ↑→∞x,btn_submit.x 這(zhè)兩個(gè)參數(£≥© shù),我把form 的(de)method改成get,從(c‍×'≈óng)地(dì)址欄中去(qù)掉這(zhè)兩個(gè)≥ σ參數(shù)再打開(kāi),成功轉向支付寶收銀$£≥•(yín)台頁面,看(kàn)來(lái)果然是(shì)兩個(gè)參數( λ∑σshù)搞得(de)鬼!

google了(le)下(xià)submit.x,得(deπσ×)到(dào)如(rú)下(xià)答(dá)案


根據圖形提交按鈕行(xíng)為(wèi)​¥W3C的(de)描述 :

When a pointing device is used to c¥εlick on the image, the form isπ​Ω submitted and the cli↕‌ ♦ck coordinates passed to the se↓✔₽rver.
當指針設備用(yòng)于在圖像上(shàng★≈α)點擊,表單提交和(hé)點擊坐(zuò)标傳遞給服務器(qì)。

The x value is measured in pixels from¶↓ the left of the ima​←₹ge, and the y value in pixels from t€γhe top of the image.
在x值的(de)單位是(shì)像素從(cóng)α→✘≈左邊的(de)形象,以像素為(wèi)單位從(cóng)圖像的(☆→≤de)頂部y值。

The submitted data includes name.x=x-v←β×​alue and name.y=y-value where &ldquo✔ α≈;name” is the value of the name >∏attribute, and x-value and y-val‍€™±ue are the x and y coordinate valueγ‍s, respectively.
提交的(de)數(shù)據包括name.x ≠©= x值和(hé)name.y = y值在“名稱→↔”的(de)名稱屬性值和(hé)x值和↔₹✘≠(hé)y值是(shì)x和(hé)y坐(zuò)标值。

于是(shì)這(zhè)還(hái)是(s  hì)W3C的(de)标準,現(xiàn)在的(de)問(wèn)題÷>φ•就(jiù)是(shì)如(rú)何避免浏覽器(qì‍≈)“多(duō)此一(yī)舉&rd♦¶↓quo;了(le),很(hěn)簡單,在表單添加onsubmit=₹§¶¥”this.submit(); retδ←♣urn false;”,即修改zencarΩ¶€t的(de)訂單确認頁面模闆tpl_checkout_confirm≤∑πγation_default.php文(w☆ ♣én)件(jiàn)中的(de)

echo zen_draw_form(&lsq∏↔uo;checkout_confirmationσ​’, $form_action_url, ‘©Ω±₩post’, ‘id=”chec✘π♠kout_confirmation”&r¶≈dquo;submitonce();”&ls←φ☆quo;);

修改為(wèi)

echo zen_draw_form(&lsqu₩♠ ↔o;checkout_confirmat¶§ion’, $form_ac←π✔↔tion_url, ‘post&&←δrsquo;, ‘id=&rdq→ uo;checkout_confirma§ →tion””this.submi←♦↕™t();return false;”&lsqu¶"±o;);