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>"'>"</span><span>;</span> </li></ol>
修改为
<ol><li value="1"> <span>$sHtml </span><span>=</span><span> $sHtml</span><span>.</span><span>""</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>"'>"</span><span>;</span> </li></ol>
即可
很早的时候就在博客中接入了支付宝:www.webyang.net/Index/alipay,一直没在意这个问题~今天把它给处理了。
原文:www.webyang.net/Html/web/article_156.html
版权声明:本文为博主原创文章,未经博主允许不得转载。
以上就介绍了解决php支付宝接口支付时会跳到一个确定按钮页,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。