php支付寶接口成功接入後,發現付款時,中間會跳到一個有確定按鈕的頁面,這個很影響用戶體驗,該怎麼解決呢?
檢查程式碼發現alipayapi.php 有這麼一段程式碼:
<ol> <li value="1"> <span>$alipaySubmit </span><span>=</span><span></span><span>new</span><span></span><span>AlipaySubmit</span><span>(</span><span>$alipay_config</span><span>);</span> </li> <li> <span>$html_text </span><span>=</span><span> $alipaySubmit</span><span>-></span><span>buildRequestForm</span><span>(</span><span>$parameter</span><span>,</span><span>"post"</span><span>,</span><span></span><span>"确认"</span><span>);</span> </li> <li> <span>echo $html_text</span><span>;</span> </li> </ol>
其中'確定'按鈕就是buildRequestForm回傳的,找到這個方法定義的地方:
lib/alipay_submit.class.php
將修改方法中
<ol><li value="1"> <span>$sHtml </span><span>=</span><span> $sHtml</span><span>.</span><span>"<input type='submit' value='"</span><span>.</span><span>$button_name</span><span>.</span><span>"'></form>"</span><span>;</span> </li></ol>
為
<ol><li value="1"> <span>$sHtml </span><span>=</span><span> $sHtml</span><span>.</span><span>"</form>"</span><span>;</span><span></span> </li></ol>
或修改為
<ol><li value="1"> <span>$sHtml </span><span>=</span><span> $sHtml</span><span>.</span><span>"<input type='submit' value='"</span><span>.</span><span>$button_name</span><span>.</span><span>"'></form>"</span><span>;</span> </li></ol>
即可
很早的時候就在博客中接入了支付寶:www.webyang.net/Index/alipay,一直沒在意這個問題~今天把它給處理了。
原文:www.webyang.net/Html/web/article_156.html
版權聲明:本文為部落客原創文章,未經部落客允許不得轉載。
以上就介紹了解決php支付寶介面付款時會跳到一個確定按鈕頁,包含了方面的內容,希望對PHP教學有興趣的朋友有所幫助。